@avsbhq/node 1.8.0 → 1.9.0

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.
package/README.md CHANGED
@@ -520,6 +520,17 @@ server.utils.hydrateBootstrap(blob); // blob must carry `datafile`
520
520
 
521
521
  `hydrateBootstrap` THROWS on a blob that carries only a pre-evaluated snapshot: a snapshot belongs to one context, and a server evaluates a different context per request, so adopting one process-wide would serve one user's values to another. Serialize with `{ includeDatafile: true }`, or pass `bootstrap: blob.datafile`.
522
522
 
523
+ ### Fresh snapshots
524
+
525
+ ```ts
526
+ const ctx = { kind: 'user', key: 'user-123' };
527
+
528
+ const snap = server.utils.snapshot(ctx); // values in memory, no network call
529
+ const fresh = await server.utils.snapshotFresh(ctx); // fetches the datafile first
530
+ ```
531
+
532
+ `snapshotFresh` and `refreshAndSnapshot` call `refreshDatafile()` before they read, so the snapshot reflects the flags published right now. A failed fetch keeps the datafile already in memory, logs a warning, and the snapshot shows that datafile. Before 1.9.0 both helpers skipped the fetch and returned the in-memory values.
533
+
523
534
  For Next.js SSR see `@avsbhq/next`.
524
535
 
525
536
  ---