MCPcopy Create free account
hub / github.com/freecodexyz/free-code / updateFileHistoryState

Function updateFileHistoryState

src/screens/REPL.tsx:2445–2457  ·  view source on GitHub ↗
(updater: (prev: FileHistoryState) => FileHistoryState)

Source from the content-addressed store, hash-verified

2443 messages,
2444 setMessages,
2445 updateFileHistoryState(updater: (prev: FileHistoryState) => FileHistoryState) {
2446 // Perf: skip the setState when the updater returns the same reference
2447 // (e.g. fileHistoryTrackEdit returns `state` when the file is already
2448 // tracked). Otherwise every no-op call would notify all store listeners.
2449 setAppState(prev => {
2450 const updated = updater(prev.fileHistory);
2451 if (updated === prev.fileHistory) return prev;
2452 return {
2453 ...prev,
2454 fileHistory: updated
2455 };
2456 });
2457 },
2458 updateAttributionState(updater: (prev: AttributionState) => AttributionState) {
2459 setAppState(prev => {
2460 const updated = updater(prev.attribution);

Callers 3

fileHistoryTrackEditFunction · 0.85
fileHistoryMakeSnapshotFunction · 0.85
fileHistoryRewindFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected