init
This commit is contained in:
commit
ec53fcbe95
1905 changed files with 513762 additions and 0 deletions
16
services/compact/compactWarningHook.ts
Normal file
16
services/compact/compactWarningHook.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import { useSyncExternalStore } from 'react'
|
||||
import { compactWarningStore } from './compactWarningState.js'
|
||||
|
||||
/**
|
||||
* React hook to subscribe to compact warning suppression state.
|
||||
*
|
||||
* Lives in its own file so that compactWarningState.ts stays React-free:
|
||||
* microCompact.ts imports the pure state functions, and pulling React into
|
||||
* that module graph would drag it into the print-mode startup path.
|
||||
*/
|
||||
export function useCompactWarningSuppression(): boolean {
|
||||
return useSyncExternalStore(
|
||||
compactWarningStore.subscribe,
|
||||
compactWarningStore.getState,
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue