Fix infinite render loop, fix repertoire entry removal

This commit is contained in:
2025-10-10 15:30:41 +02:00
parent 6ea21aa0f1
commit 4b1f7c260b
3 changed files with 4 additions and 4 deletions

View File

@@ -54,7 +54,7 @@ export function useCache<K, A, E>(cache: Cache.Cache<K, A, E>, key: NoInfer<K>):
const subscribe = useMemo(() => cache.subscribe.bind(undefined, key), [cache.subscribe, key]);
const selector = useCallback(() => cache.getCurrent(key), [cache.getCurrent, key]);
const state = useSyncExternalStore(subscribe, selector);
const state = Option.fromNullable(useSyncExternalStore(subscribe, selector));
useLayoutEffect(() => { Effect.runFork(cache.get(key)); }, [cache.get, key]);

View File

@@ -199,7 +199,7 @@ function EntryRow({
const removeAction = (entries: readonly Piece[]) => pipe(
entries,
Array.filter((p) => p.pieceId !== piece.pieceId),
Array.remove(no - 1),
);
const update = (action: (prev: readonly Piece[]) => readonly Piece[]) => Effect.gen(function* () {