Skip to content

Instantly share code, notes, and snippets.

@TheLucifurry
Created September 11, 2024 12:18
Show Gist options
  • Select an option

  • Save TheLucifurry/7d5bb7691c18b1a2e9f6a7871bd37373 to your computer and use it in GitHub Desktop.

Select an option

Save TheLucifurry/7d5bb7691c18b1a2e9f6a7871bd37373 to your computer and use it in GitHub Desktop.
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