Skip to content

Commit

Permalink
chore: Cleanup old debugging code
Browse files Browse the repository at this point in the history
  • Loading branch information
franky47 committed Oct 27, 2023
1 parent d8b0f5f commit fefb3d2
Showing 1 changed file with 0 additions and 48 deletions.
48 changes: 0 additions & 48 deletions packages/next-usequerystate/src/useQueryStates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,22 +112,6 @@ export function useQueryStates<KeyMap extends UseQueryStatesKeysMap>(
defaultValue,
stateRef.current
)
// __DEBUG__ &&
// performance.mark(
// `[nuq+ \`${Object.keys(keyMap).join(
// ','
// )}\`] Cross-hook key sync \`${key}\`: ${value} (default: ${defaultValue}). Resolved state: ${JSON.stringify(
// stateRef.current
// )}`
// ) &&
// console.debug(
// `[nuq+ \`${Object.keys(keyMap).join(
// ','
// )}\`] Cross-hook key sync \`${key}\`: %O (default: %O). Resolved state: %O`,
// value,
// defaultValue,
// stateRef.current
// )
updateInternalState(stateRef.current)
}
return handlers
Expand All @@ -136,34 +120,12 @@ export function useQueryStates<KeyMap extends UseQueryStatesKeysMap>(
emitter.on(SYNC_EVENT_KEY, syncFromURL)
for (const key of Object.keys(keyMap)) {
debug('[nuq+ `%s`] Subscribing to sync for `%s`', keys, key)
// __DEBUG__ &&
// performance.mark(
// `[nuq+ \`${Object.keys(keyMap).join(
// ','
// )}\`] Subscribing to sync for \`${key}\``
// ) &&
// console.debug(
// `[nuq+ \`${Object.keys(keyMap).join(
// ','
// )}\`] Subscribing to sync for \`${key}\``
// )
emitter.on(key, handlers[key])
}
return () => {
emitter.off(SYNC_EVENT_KEY, syncFromURL)
for (const key of Object.keys(keyMap)) {
debug('[nuq+ `%s`] Unsubscribing to sync for `%s`', keys, key)
// __DEBUG__ &&
// performance.mark(
// `[nuq+ \`${Object.keys(keyMap).join(
// ','
// )}\`] Unsubscribing to sync for \`${key}\``
// ) &&
// console.debug(
// `[nuq+ \`${Object.keys(keyMap).join(
// ','
// )}\`] Unsubscribing to sync for \`${key}\``
// )
emitter.off(key, handlers[key])
}
}
Expand All @@ -176,16 +138,6 @@ export function useQueryStates<KeyMap extends UseQueryStatesKeysMap>(
? stateUpdater(stateRef.current)
: stateUpdater
debug('[nuq+ `%s`] setState: %O', keys, newState)
// __DEBUG__ &&
// performance.mark(
// `[nuq+ \`${Object.keys(keyMap).join(
// ','
// )}\`] setState: ${JSON.stringify(newState)}`
// ) &&
// console.debug(
// `[nuq+ \`${Object.keys(keyMap).join(',')}\`] setState: %O`,
// newState
// )
for (const [key, value] of Object.entries(newState)) {
const config = keyMap[key]
if (!config) {
Expand Down

0 comments on commit fefb3d2

Please sign in to comment.