mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2025-07-29 05:00:06 +02:00

Move scope values starting with `editor.` to contexts GitOrigin-RevId: 7ca349ceff002228cf4e931c644c8c386eb6c597
11 lines
363 B
TypeScript
11 lines
363 B
TypeScript
import { useIdeContext } from '@/shared/context/ide-context'
|
|
import { useEffect } from 'react'
|
|
|
|
export function useUnstableStoreSync<T = any>(path: string, value: T) {
|
|
const { unstableStore } = useIdeContext()
|
|
|
|
// Update the unstable store whenever the value changes
|
|
useEffect(() => {
|
|
unstableStore.set(path, value)
|
|
}, [unstableStore, path, value])
|
|
}
|