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
co-authored by Robin
parent dc52573ce2
commit a9fd98c563
+1 -1
View File
@@ -37,7 +37,7 @@ export function createStaticViewModel<Snapshot>(
export function useStaticViewModel<Snapshot>( export function useStaticViewModel<Snapshot>(
snapshot: Snapshot, snapshot: Snapshot,
): ViewModel<Snapshot> { ): ViewModel<Snapshot> {
const [vm] = useState(createStaticViewModel(snapshot)); const [vm] = useState(() => createStaticViewModel(snapshot));
useEffect(() => { useEffect(() => {
for (const key in snapshot) { for (const key in snapshot) {
(vm as unknown as Record<string, BehaviorSubject<unknown>>)[ (vm as unknown as Record<string, BehaviorSubject<unknown>>)[