Update src/state/ViewModel.ts

Co-authored-by: Robin <robin@robin.town>
This commit is contained in:
Timo
2026-05-20 17:16:08 +02:00
committed by GitHub
parent dc52573ce2
commit a9fd98c563

View File

@@ -37,7 +37,7 @@ export function createStaticViewModel<Snapshot>(
export function useStaticViewModel<Snapshot>(
snapshot: Snapshot,
): ViewModel<Snapshot> {
const [vm] = useState(createStaticViewModel(snapshot));
const [vm] = useState(() => createStaticViewModel(snapshot));
useEffect(() => {
for (const key in snapshot) {
(vm as unknown as Record<string, BehaviorSubject<unknown>>)[