@plasmicapp/react-web 0.2.308 → 0.2.310
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/dist/index.cjs.js +35 -8
- package/dist/index.cjs.js.map +1 -1
- package/dist/react-web.esm.js +35 -8
- package/dist/react-web.esm.js.map +1 -1
- package/package.json +3 -3
- package/skinny/dist/index.js +35 -8
- package/skinny/dist/index.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plasmicapp/react-web",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.310",
|
|
4
4
|
"description": "plasmic library for rendering in the presentational style",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"@plasmicapp/data-sources": "0.1.143",
|
|
91
91
|
"@plasmicapp/data-sources-context": "0.1.20",
|
|
92
92
|
"@plasmicapp/host": "1.0.185",
|
|
93
|
-
"@plasmicapp/loader-splits": "1.0.
|
|
93
|
+
"@plasmicapp/loader-splits": "1.0.53",
|
|
94
94
|
"@plasmicapp/prepass": "1.0.13",
|
|
95
95
|
"@plasmicapp/query": "0.1.77",
|
|
96
96
|
"@react-aria/checkbox": "^3.11.2",
|
|
@@ -157,5 +157,5 @@
|
|
|
157
157
|
"react": ">=16.8.0",
|
|
158
158
|
"react-dom": ">=16.8.0"
|
|
159
159
|
},
|
|
160
|
-
"gitHead": "
|
|
160
|
+
"gitHead": "06322ab98d09d2a4f26e68939555898c57d2d082"
|
|
161
161
|
}
|
package/skinny/dist/index.js
CHANGED
|
@@ -944,6 +944,7 @@ function findStateCell(root, pathStr, repetitionIndex) {
|
|
|
944
944
|
};
|
|
945
945
|
}
|
|
946
946
|
|
|
947
|
+
var defer = setTimeout;
|
|
947
948
|
function isNum$1(value) {
|
|
948
949
|
return typeof value === "symbol" ? false : !isNaN(+value);
|
|
949
950
|
}
|
|
@@ -1234,6 +1235,22 @@ function useDollarState(specs) {
|
|
|
1234
1235
|
rest[_i - 1] = arguments[_i];
|
|
1235
1236
|
}
|
|
1236
1237
|
var _a = extractDollarStateParametersBackwardCompatible.apply(void 0, __spreadArray([], __read(rest), false)), env = _a.env, opts = _a.opts;
|
|
1238
|
+
var _b = __read(React__default.useState(), 2), setState = _b[1];
|
|
1239
|
+
var mountedRef = React__default.useRef(false);
|
|
1240
|
+
var isMounted = React__default.useCallback(function () { return mountedRef.current; }, []);
|
|
1241
|
+
React__default.useEffect(function () {
|
|
1242
|
+
mountedRef.current = true;
|
|
1243
|
+
return function () { return (mountedRef.current = false); };
|
|
1244
|
+
}, []);
|
|
1245
|
+
var pendingUpdate = React__default.useRef(false);
|
|
1246
|
+
var forceUpdate = React__default.useCallback(function () {
|
|
1247
|
+
return defer(function () {
|
|
1248
|
+
if (isMounted()) {
|
|
1249
|
+
setState([]);
|
|
1250
|
+
pendingUpdate.current = false;
|
|
1251
|
+
}
|
|
1252
|
+
});
|
|
1253
|
+
}, []);
|
|
1237
1254
|
var $$state = React__default.useRef((function () {
|
|
1238
1255
|
var rootSpecTree = buildTree(specs);
|
|
1239
1256
|
return {
|
|
@@ -1242,7 +1259,7 @@ function useDollarState(specs) {
|
|
|
1242
1259
|
stateValues: proxy({}),
|
|
1243
1260
|
env: envFieldsAreNonNill(env),
|
|
1244
1261
|
specs: [],
|
|
1245
|
-
registrationsQueue:
|
|
1262
|
+
registrationsQueue: [],
|
|
1246
1263
|
stateInitializationEnv: { stack: [], visited: new Set() },
|
|
1247
1264
|
};
|
|
1248
1265
|
})()).current;
|
|
@@ -1279,14 +1296,18 @@ function useDollarState(specs) {
|
|
|
1279
1296
|
? envFieldsAreNonNill(overrideEnv)
|
|
1280
1297
|
: $$state.env;
|
|
1281
1298
|
if (!deepEqual(stateCell.initialValue, f(__assign({ $state: $state }, env)))) {
|
|
1282
|
-
$$state.registrationsQueue.push(
|
|
1299
|
+
$$state.registrationsQueue.push({
|
|
1283
1300
|
node: node,
|
|
1284
1301
|
path: realPath,
|
|
1285
1302
|
f: f,
|
|
1286
1303
|
overrideEnv: overrideEnv
|
|
1287
1304
|
? envFieldsAreNonNill(overrideEnv)
|
|
1288
1305
|
: undefined,
|
|
1289
|
-
})
|
|
1306
|
+
});
|
|
1307
|
+
if (!pendingUpdate.current) {
|
|
1308
|
+
pendingUpdate.current = true;
|
|
1309
|
+
forceUpdate();
|
|
1310
|
+
}
|
|
1290
1311
|
}
|
|
1291
1312
|
} }, ((opts === null || opts === void 0 ? void 0 : opts.inCanvas)
|
|
1292
1313
|
? {
|
|
@@ -1357,9 +1378,16 @@ function useDollarState(specs) {
|
|
|
1357
1378
|
getStateCells($state, $$state.rootSpecTree).forEach(function (stateCell) {
|
|
1358
1379
|
var _a;
|
|
1359
1380
|
if (stateCell.initFunc) {
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1381
|
+
try {
|
|
1382
|
+
var newInit = invokeInitFuncBackwardsCompatible(stateCell.initFunc, __assign({ $state: $state }, ((_a = stateCell.overrideEnv) !== null && _a !== void 0 ? _a : envFieldsAreNonNill(env))));
|
|
1383
|
+
if (!deepEqual(newInit, stateCell.initialValue)) {
|
|
1384
|
+
resetSpecs.push({ stateCell: stateCell });
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
catch (_b) {
|
|
1388
|
+
// Exception may be thrown from initFunc -- for example, if it tries to access $queries
|
|
1389
|
+
// that are still loading. We swallow those here, since we're only interested in
|
|
1390
|
+
// checking if the init value has changed, not in handling these errors.
|
|
1363
1391
|
}
|
|
1364
1392
|
}
|
|
1365
1393
|
});
|
|
@@ -1376,7 +1404,7 @@ function useDollarState(specs) {
|
|
|
1376
1404
|
stateCell.overrideEnv = overrideEnv;
|
|
1377
1405
|
reInitializeState(stateCell);
|
|
1378
1406
|
}
|
|
1379
|
-
}
|
|
1407
|
+
});
|
|
1380
1408
|
// immediately initialize exposed non-private states
|
|
1381
1409
|
useIsomorphicLayoutEffect(function () {
|
|
1382
1410
|
$$state.specTreeLeaves.forEach(function (node) {
|
|
@@ -1389,7 +1417,6 @@ function useDollarState(specs) {
|
|
|
1389
1417
|
}, []);
|
|
1390
1418
|
// Re-render if any value changed in one of these objects
|
|
1391
1419
|
useSnapshot($$state.stateValues, { sync: true });
|
|
1392
|
-
useSnapshot($$state.registrationsQueue, { sync: true });
|
|
1393
1420
|
return $state;
|
|
1394
1421
|
}
|
|
1395
1422
|
|