(updater: (prev: FileHistoryState) => FileHistoryState)
| 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); |
no outgoing calls
no test coverage detected