(updater: (prev: FileHistoryState) => FileHistoryState)
| 2945 | messages, |
| 2946 | setMessages, |
| 2947 | updateFileHistoryState(updater: (prev: FileHistoryState) => FileHistoryState) { |
| 2948 | // Perf: skip the setState when the updater returns the same reference |
| 2949 | // (e.g. fileHistoryTrackEdit returns `state` when the file is already |
| 2950 | // tracked). Otherwise every no-op call would notify all store listeners. |
| 2951 | setAppState(prev => { |
| 2952 | const updated = updater(prev.fileHistory); |
| 2953 | if (updated === prev.fileHistory) return prev; |
| 2954 | return { ...prev, fileHistory: updated }; |
| 2955 | }); |
| 2956 | }, |
| 2957 | updateAttributionState(updater: (prev: AttributionState) => AttributionState) { |
| 2958 | setAppState(prev => { |
| 2959 | const updated = updater(prev.attribution); |
no test coverage detected