@schematichq/schematic-react 0.1.7 → 0.1.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.
@@ -256,7 +256,7 @@ var Schematic = class {
|
|
256
256
|
if (this.conn) {
|
257
257
|
resolve();
|
258
258
|
}
|
259
|
-
const wsUrl = `${this.webSocketUrl}/flags/
|
259
|
+
const wsUrl = `${this.webSocketUrl}/flags/bootstrap`;
|
260
260
|
const webSocket = new WebSocket(wsUrl);
|
261
261
|
this.conn = webSocket;
|
262
262
|
webSocket.onopen = () => {
|
@@ -272,6 +272,7 @@ var Schematic = class {
|
|
272
272
|
return new Promise((resolve, reject) => {
|
273
273
|
if (contextString(context) == contextString(this.context)) {
|
274
274
|
resolve();
|
275
|
+
return;
|
275
276
|
}
|
276
277
|
this.context = context;
|
277
278
|
if (!this.conn) {
|
@@ -282,9 +283,14 @@ var Schematic = class {
|
|
282
283
|
let resolved = false;
|
283
284
|
this.conn.onmessage = (event) => {
|
284
285
|
const message = JSON.parse(event.data);
|
285
|
-
(
|
286
|
-
this.values[contextString(context)]
|
287
|
-
}
|
286
|
+
if (!(contextString(context) in this.values)) {
|
287
|
+
this.values[contextString(context)] = {};
|
288
|
+
}
|
289
|
+
(message.flags ?? []).forEach(
|
290
|
+
(flag) => {
|
291
|
+
this.values[contextString(context)][flag.flag] = flag.value;
|
292
|
+
}
|
293
|
+
);
|
288
294
|
if (this.flagListener) {
|
289
295
|
this.flagListener(this.values[contextString(context)]);
|
290
296
|
}
|
@@ -225,7 +225,7 @@ var Schematic = class {
|
|
225
225
|
if (this.conn) {
|
226
226
|
resolve();
|
227
227
|
}
|
228
|
-
const wsUrl = `${this.webSocketUrl}/flags/
|
228
|
+
const wsUrl = `${this.webSocketUrl}/flags/bootstrap`;
|
229
229
|
const webSocket = new WebSocket(wsUrl);
|
230
230
|
this.conn = webSocket;
|
231
231
|
webSocket.onopen = () => {
|
@@ -241,6 +241,7 @@ var Schematic = class {
|
|
241
241
|
return new Promise((resolve, reject) => {
|
242
242
|
if (contextString(context) == contextString(this.context)) {
|
243
243
|
resolve();
|
244
|
+
return;
|
244
245
|
}
|
245
246
|
this.context = context;
|
246
247
|
if (!this.conn) {
|
@@ -251,9 +252,14 @@ var Schematic = class {
|
|
251
252
|
let resolved = false;
|
252
253
|
this.conn.onmessage = (event) => {
|
253
254
|
const message = JSON.parse(event.data);
|
254
|
-
(
|
255
|
-
this.values[contextString(context)]
|
256
|
-
}
|
255
|
+
if (!(contextString(context) in this.values)) {
|
256
|
+
this.values[contextString(context)] = {};
|
257
|
+
}
|
258
|
+
(message.flags ?? []).forEach(
|
259
|
+
(flag) => {
|
260
|
+
this.values[contextString(context)][flag.flag] = flag.value;
|
261
|
+
}
|
262
|
+
);
|
257
263
|
if (this.flagListener) {
|
258
264
|
this.flagListener(this.values[contextString(context)]);
|
259
265
|
}
|
package/package.json
CHANGED
@@ -42,9 +42,9 @@
|
|
42
42
|
"test": "jest --config jest.config.js"
|
43
43
|
},
|
44
44
|
"types": "dist/schematic-react.d.ts",
|
45
|
-
"version": "0.1.
|
45
|
+
"version": "0.1.8",
|
46
46
|
"dependencies": {
|
47
|
-
"@schematichq/schematic-js": "^0.1.
|
47
|
+
"@schematichq/schematic-js": "^0.1.10"
|
48
48
|
},
|
49
49
|
"peerDependencies": {
|
50
50
|
"react": ">=18"
|