msgpackr 1.11.13 → 1.11.14

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.
@@ -1362,7 +1362,14 @@
1362
1362
  let newSharedData = prepareStructures(structures, packr);
1363
1363
  if (!encodingError) { // TODO: If there is an encoding error, should make the structures as uninitialized so they get rebuilt next time
1364
1364
  if (packr.saveStructures(newSharedData, newSharedData.isCompatible) === false) {
1365
- // get updated structures and try again if the update failed
1365
+ // The save was declined (a concurrent writer updated the shared structures,
1366
+ // or the store transaction did not durably commit). Our in-memory
1367
+ // structures + transition trie may now reference record ids that were
1368
+ // never persisted; re-packing as-is would re-emit the same record pointing
1369
+ // at an unpersisted structure (-> "Record id is not defined" on decode).
1370
+ // Mark structures uninitialized so the re-pack reloads durable structures
1371
+ // via getStructures, rebuilds the transition trie, and re-mints + re-saves.
1372
+ structures.uninitialized = true;
1366
1373
  return packr.pack(value, encodeOptions)
1367
1374
  }
1368
1375
  packr.lastNamedStructuresLength = sharedLength;