You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// For the given `from`, there should be exactly one doc
198
-
// block.
199
-
assert(prev===undefined);
200
-
assert(
201
-
effect.value.from===from,
202
-
`${effect.value.from} !== ${from}`,
203
-
);
204
-
prev=value;
205
-
to=to_found;
197
+
// Only look for blocks whose from is as specified. `between` will also return blocks whose to matches -- for example, given from = 1, one doc block of [0, 1], and another of [1, 2], *both* will be found; we want only the [1, 2] doc block.
198
+
if(effect.value.from===from){
199
+
// For the given `from`, there should be exactly one doc
200
+
// block.
201
+
if(prev!==undefined){
202
+
console.error({ doc_blocks, effect });
203
+
assert(
204
+
false,
205
+
"More than one doc block at one location found.",
206
+
);
207
+
}
208
+
prev=value;
209
+
to=to_found;
210
+
211
+
// We could return `false` here to stop the search for efficiency. However, we let it continue in case there are two doc blocks with the same `from` value, so we can at least flag this error.
212
+
}
206
213
},
207
214
);
208
-
assert(prev!==undefined);
215
+
if(prev===undefined){
216
+
console.error({ doc_blocks, effect });
217
+
assert(false,"No doc block found.");
218
+
}
209
219
doc_blocks=doc_blocks.update({
210
220
// Remove the old doc block. We assume there's only one
0 commit comments