@polycode-projects/the-mechanical-code-talker 5.0.29 → 5.0.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -136,7 +136,26 @@ export function createNewsSession({
136
136
  const memoryDir = createInMemoryStore();
137
137
  applySeedPayload(memoryDir, seedPayload);
138
138
 
139
- const store = { loadMemory, readFactRows, appendFacts, removeFacts };
139
+ // Folding the seeded store is seconds of main-thread work in a browser,
140
+ // and every session verb reads rows — uncached, a 30-item feed render
141
+ // folds the whole store once per item and freezes the page for minutes.
142
+ // One fold per write epoch keeps every read on the same rows.
143
+ let foldedRows = null;
144
+ const store = {
145
+ loadMemory,
146
+ readFactRows(memory) {
147
+ if (!foldedRows) foldedRows = readFactRows(memory);
148
+ return foldedRows;
149
+ },
150
+ async appendFacts(...args) {
151
+ foldedRows = null;
152
+ return appendFacts(...args);
153
+ },
154
+ async removeFacts(...args) {
155
+ foldedRows = null;
156
+ return removeFacts(...args);
157
+ },
158
+ };
140
159
  const cache = { rows: null };
141
160
  let lexicon = loadLexicon();
142
161
  let config = resolveNewsConfig();