Created
September 11, 2024 12:18
-
-
Save TheLucifurry/7d5bb7691c18b1a2e9f6a7871bd37373 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function useSetComputed<T>(getter: () => SetConstructorParameter<T>) { | |
| const set = useSet<T>(getter()) | |
| watch(getter, (items) => { | |
| set.clear() | |
| if (items) | |
| [...items].forEach((i) => set.add(i)) | |
| }) | |
| return set | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment