Some metrics

This commit is contained in:
Eric Bailey
2025-06-10 10:05:04 -05:00
parent ae329bd733
commit 5b7f34a1d5
4 changed files with 50 additions and 1 deletions
+20
View File
@@ -0,0 +1,20 @@
import {useCallback} from 'react'
export enum OnceKey {
PreferencesThread = 'preferences:thread',
}
const called: Record<OnceKey, boolean> = {
[OnceKey.PreferencesThread]: false,
}
export function useCallOnce(key: OnceKey) {
return useCallback(
(cb: () => void) => {
if (called[key] === true) return
called[key] = true
cb()
},
[key],
)
}