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