Skip to content

Conversation

@itsmartashub
Copy link
Owner

  • Replace manually added and removed event listeners for closing custom settings and theme manager with vueuse's onClickOutside utility
  • Use watchers to handle the closing behavior more effectively and cleanly
  • Remove unused code from the theme manager and custom settings for improved maintainability
  • Simplify logic and reduce potential bugs by leveraging vueuse functionality

Changes summary:

  • Replaced manual event listeners for closing custom settings and theme manager with the onClickOutside utility from vueuse. This simplifies the code and ensures proper cleanup. Additionally, unused code from the theme manager and custom settings was removed to streamline the implementation and improve maintainability.

… `onClickOutside` and clean up unused code

- Replace manually added and removed event listeners for closing custom settings and theme manager with `vueuse`'s `onClickOutside` utility
- Use watchers to handle the closing behavior more effectively and cleanly
- Remove unused code from the theme manager and custom settings for improved maintainability
- Simplify logic and reduce potential bugs by leveraging `vueuse` functionality

Changes summary:
- Replaced manual event listeners for closing custom settings and theme manager with the `onClickOutside` utility from `vueuse`. This simplifies the code and ensures proper cleanup. Additionally, unused code from the theme manager and custom settings was removed to streamline the implementation and improve maintainability.
…ngs and theme manager

- Fixed critical bug where clicking the 'settings' button inside the theme manager
  would immediately close the settings panel due to a missing ignore rule in the
  onClickOutside handler.

- Added { ignore: [refRollerButton] } to the settings listener to prevent the
  opener button from triggering the close action.

- Fixed incorrect import of 'watchEffect' instead of 'watch'.

- Enhanced robustness by adding { flush: 'post' } option to watchers. This
  ensures the DOM has been updated and template refs are populated before
  the onClickOutside listener is attached, preventing potential errors with
  null references.

- Added a safety cleanup with onScopeDispose to remove any active event
  listeners when the component is unmounted, preventing memory leaks.

The listeners are now correctly conditionally attached only when their
respective state (settingsOpen, isActive) is true and properly cleaned up
when false or on component destruction.
@itsmartashub itsmartashub self-assigned this Sep 10, 2025
@itsmartashub itsmartashub changed the title Replace manual event listeners with vueuse onClickOutside and clean up unused code Replace manual event listeners with vueuse onClickOutside Sep 10, 2025
@itsmartashub itsmartashub merged commit 4c179a5 into v3 Sep 10, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant