@ops-ai/react-router-toggly 1.5.1 → 1.5.2
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/CHANGELOG.md +21 -0
- package/README.md +1 -1
- package/dist/client.cjs +8 -1
- package/dist/client.cjs.map +1 -1
- package/dist/client.js +8 -1
- package/dist/client.js.map +1 -1
- package/dist/server.cjs.map +1 -1
- package/dist/server.js.map +1 -1
- package/package.json +23 -23
package/dist/client.js
CHANGED
|
@@ -83,6 +83,13 @@ function buildDefinitionsUrl(config, context) {
|
|
|
83
83
|
function parseVariantDefsPayload(parsed) {
|
|
84
84
|
return asVariantDefsRecord(unwrapDefsPayload(parsed));
|
|
85
85
|
}
|
|
86
|
+
function parseEvaluatedFlagsPayload(parsed) {
|
|
87
|
+
const body = unwrapDefsPayload(parsed);
|
|
88
|
+
if (!body || typeof body !== "object" || Array.isArray(body)) {
|
|
89
|
+
return {};
|
|
90
|
+
}
|
|
91
|
+
return body;
|
|
92
|
+
}
|
|
86
93
|
function variantDefsToFlags(defs) {
|
|
87
94
|
const out = {};
|
|
88
95
|
for (const key of Object.keys(defs)) {
|
|
@@ -546,7 +553,7 @@ function TogglyProviderOwner({
|
|
|
546
553
|
return newFlags2;
|
|
547
554
|
}
|
|
548
555
|
variantsRef.current = null;
|
|
549
|
-
const newFlags = payload
|
|
556
|
+
const newFlags = parseEvaluatedFlagsPayload(payload);
|
|
550
557
|
logger.debug(`Fetched ${Object.keys(newFlags).length} flags.`);
|
|
551
558
|
return newFlags;
|
|
552
559
|
} catch (error) {
|