@fluidframework/container-runtime 2.0.0-rc.2.0.7 → 2.0.0-rc.2.0.9

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.
@@ -60,6 +60,7 @@ import {
60
60
  import { AttachState } from "@fluidframework/container-definitions";
61
61
  import { buildSnapshotTree } from "@fluidframework/driver-utils";
62
62
  import { assert, Lazy, LazyPromise } from "@fluidframework/core-utils";
63
+ import { v4 as uuid } from "uuid";
63
64
  import { DataStoreContexts } from "./dataStoreContexts.js";
64
65
  import {
65
66
  DeletedResponseHeaderKey,
@@ -587,20 +588,28 @@ export class ChannelCollection implements IFluidDataStoreChannel, IDisposable {
587
588
  * Please note that above mentioned functions have the implementation they have (allowing #2) due to #1.
588
589
  */
589
590
  protected createDataStoreId(): string {
590
- // We use three non-overlapping namespaces:
591
- // - detached state: even numbers
592
- // - attached state: odd numbers
593
- // - uuids
594
- // In first two cases we will encode result as strings in more compact form.
595
- if (this.parentContext.attachState === AttachState.Detached) {
596
- // container is detached, only one client observes content, no way to hit collisions with other clients.
597
- return encodeCompactIdToString(2 * this.contexts.size);
598
- }
599
- const id = this.parentContext.containerRuntime.generateDocumentUniqueId();
600
- if (typeof id === "number") {
601
- return encodeCompactIdToString(2 * id + 1);
591
+ /**
592
+ * There is currently a bug where certain data store ids such as "[" are getting converted to ASCII characters
593
+ * in the snapshot.
594
+ * So, return short ids only if explicitly enabled via feature flags. Else, return uuid();
595
+ */
596
+ if (this.mc.config.getBoolean("Fluid.Runtime.UseShortIds") === true) {
597
+ // We use three non-overlapping namespaces:
598
+ // - detached state: even numbers
599
+ // - attached state: odd numbers
600
+ // - uuids
601
+ // In first two cases we will encode result as strings in more compact form.
602
+ if (this.parentContext.attachState === AttachState.Detached) {
603
+ // container is detached, only one client observes content, no way to hit collisions with other clients.
604
+ return encodeCompactIdToString(2 * this.contexts.size);
605
+ }
606
+ const id = this.parentContext.containerRuntime.generateDocumentUniqueId();
607
+ if (typeof id === "number") {
608
+ return encodeCompactIdToString(2 * id + 1);
609
+ }
610
+ return id;
602
611
  }
603
- return id;
612
+ return uuid();
604
613
  }
605
614
 
606
615
  public createDetachedDataStoreCore(
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/container-runtime";
9
- export const pkgVersion = "2.0.0-rc.2.0.7";
9
+ export const pkgVersion = "2.0.0-rc.2.0.9";