@fluidframework/container-runtime 2.0.0-rc.4.0.6 → 2.0.0-rc.4.0.8

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.
@@ -67,6 +67,7 @@ import {
67
67
  extractSafePropertiesFromMessage,
68
68
  tagCodeArtifacts,
69
69
  } from "@fluidframework/telemetry-utils/internal";
70
+ import { v4 as uuid } from "uuid";
70
71
 
71
72
  import {
72
73
  DeletedResponseHeaderKey,
@@ -610,20 +611,28 @@ export class ChannelCollection implements IFluidDataStoreChannel, IDisposable {
610
611
  * Please note that above mentioned functions have the implementation they have (allowing #2) due to #1.
611
612
  */
612
613
  protected createDataStoreId(): string {
613
- // We use three non-overlapping namespaces:
614
- // - detached state: even numbers
615
- // - attached state: odd numbers
616
- // - uuids
617
- // In first two cases we will encode result as strings in more compact form.
618
- if (this.parentContext.attachState === AttachState.Detached) {
619
- // container is detached, only one client observes content, no way to hit collisions with other clients.
620
- return encodeCompactIdToString(2 * this.contexts.size);
621
- }
622
- const id = this.parentContext.containerRuntime.generateDocumentUniqueId();
623
- if (typeof id === "number") {
624
- return encodeCompactIdToString(2 * id + 1);
614
+ /**
615
+ * There is currently a bug where certain data store ids such as "[" are getting converted to ASCII characters
616
+ * in the snapshot.
617
+ * So, return short ids only if explicitly enabled via feature flags. Else, return uuid();
618
+ */
619
+ if (this.mc.config.getBoolean("Fluid.Runtime.UseShortIds") === true) {
620
+ // We use three non-overlapping namespaces:
621
+ // - detached state: even numbers
622
+ // - attached state: odd numbers
623
+ // - uuids
624
+ // In first two cases we will encode result as strings in more compact form.
625
+ if (this.parentContext.attachState === AttachState.Detached) {
626
+ // container is detached, only one client observes content, no way to hit collisions with other clients.
627
+ return encodeCompactIdToString(2 * this.contexts.size);
628
+ }
629
+ const id = this.parentContext.containerRuntime.generateDocumentUniqueId();
630
+ if (typeof id === "number") {
631
+ return encodeCompactIdToString(2 * id + 1);
632
+ }
633
+ return id;
625
634
  }
626
- return id;
635
+ return uuid();
627
636
  }
628
637
 
629
638
  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.4.0.6";
9
+ export const pkgVersion = "2.0.0-rc.4.0.8";