@plasmicapp/react-web 0.2.352 → 0.2.353
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 +26 -13
- package/dist/index.cjs.js.map +1 -1
- package/dist/react-web.esm.js +26 -13
- package/dist/react-web.esm.js.map +1 -1
- package/package.json +2 -2
- package/skinny/dist/index.js +26 -13
- package/skinny/dist/index.js.map +1 -1
package/dist/react-web.esm.js
CHANGED
|
@@ -2136,12 +2136,23 @@ function initializeStateValue($$state, initialStateCell, proxyRoot) {
|
|
|
2136
2136
|
});
|
|
2137
2137
|
});
|
|
2138
2138
|
var initialValue = invokeInitFuncBackwardsCompatible(initialStateCell.initFunc, __assign({ $state: $state }, ((_a = initialStateCell.overrideEnv) !== null && _a !== void 0 ? _a : $$state.env)));
|
|
2139
|
-
initialStateCell.initialValue = clone(initialValue);
|
|
2140
2139
|
var initialSpec = initialStateCell.node.getSpec();
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2140
|
+
// Try to clone initialValue. It can fail if it's a PlasmicUndefinedDataProxy
|
|
2141
|
+
// and we still want to clear some states and return the initialValue.
|
|
2142
|
+
try {
|
|
2143
|
+
var clonedValue = clone(initialValue);
|
|
2144
|
+
initialStateCell.initialValue = clonedValue;
|
|
2145
|
+
var value = initialSpec.isImmutable
|
|
2146
|
+
? mkUntrackedValue(initialValue)
|
|
2147
|
+
: clonedValue;
|
|
2148
|
+
set(proxyRoot, initialStateCell.path, value);
|
|
2149
|
+
}
|
|
2150
|
+
catch (_d) {
|
|
2151
|
+
// Setting the state to undefined to make sure it gets re-initialized
|
|
2152
|
+
// in case it changes values.
|
|
2153
|
+
initialStateCell.initialValue = undefined;
|
|
2154
|
+
set(proxyRoot, initialStateCell.path, undefined);
|
|
2155
|
+
}
|
|
2145
2156
|
//immediately fire onChange
|
|
2146
2157
|
if (initialSpec.onChangeProp) {
|
|
2147
2158
|
(_c = (_b = $$state.env.$props)[initialSpec.onChangeProp]) === null || _c === void 0 ? void 0 : _c.call(_b, initialValue);
|
|
@@ -2313,7 +2324,9 @@ function useDollarState(specs) {
|
|
|
2313
2324
|
var isMounted = React__default.useCallback(function () { return mountedRef.current; }, []);
|
|
2314
2325
|
React__default.useEffect(function () {
|
|
2315
2326
|
mountedRef.current = true;
|
|
2316
|
-
return function () {
|
|
2327
|
+
return function () {
|
|
2328
|
+
mountedRef.current = false;
|
|
2329
|
+
};
|
|
2317
2330
|
}, []);
|
|
2318
2331
|
var pendingUpdate = React__default.useRef(false);
|
|
2319
2332
|
var forceUpdate = React__default.useCallback(function () {
|
|
@@ -2351,9 +2364,9 @@ function useDollarState(specs) {
|
|
|
2351
2364
|
}
|
|
2352
2365
|
return {
|
|
2353
2366
|
get: function () {
|
|
2354
|
-
var
|
|
2355
|
-
if (
|
|
2356
|
-
var valueProp = $$state.env.$props[
|
|
2367
|
+
var currSpec = stateCell.node.getSpec();
|
|
2368
|
+
if (currSpec.valueProp) {
|
|
2369
|
+
var valueProp = $$state.env.$props[currSpec.valueProp];
|
|
2357
2370
|
subscribeToValtio($$state, stateCell.path, stateCell.node);
|
|
2358
2371
|
return valueProp;
|
|
2359
2372
|
}
|
|
@@ -2365,10 +2378,10 @@ function useDollarState(specs) {
|
|
|
2365
2378
|
}), __assign({ registerInitFunc: function (pathStr, f, repetitionIndex, overrideEnv) {
|
|
2366
2379
|
var _a = findStateCell($$state.rootSpecTree, pathStr, repetitionIndex), node = _a.node, realPath = _a.realPath;
|
|
2367
2380
|
var stateCell = getStateCellFrom$StateRoot($state, realPath);
|
|
2368
|
-
var
|
|
2381
|
+
var innerEnv = overrideEnv
|
|
2369
2382
|
? envFieldsAreNonNill(overrideEnv)
|
|
2370
2383
|
: $$state.env;
|
|
2371
|
-
if (!deepEqual(stateCell.initialValue, f(__assign({ $state: $state },
|
|
2384
|
+
if (!deepEqual(stateCell.initialValue, f(__assign({ $state: $state }, innerEnv)))) {
|
|
2372
2385
|
$$state.registrationsQueue.push({
|
|
2373
2386
|
node: node,
|
|
2374
2387
|
path: realPath,
|
|
@@ -2384,7 +2397,7 @@ function useDollarState(specs) {
|
|
|
2384
2397
|
}
|
|
2385
2398
|
} }, ((opts === null || opts === void 0 ? void 0 : opts.inCanvas)
|
|
2386
2399
|
? {
|
|
2387
|
-
eagerInitializeStates: function (
|
|
2400
|
+
eagerInitializeStates: function (stateSpecs) {
|
|
2388
2401
|
// we need to eager initialize all states in canvas to populate the data picker
|
|
2389
2402
|
$$state.specTreeLeaves.forEach(function (node) {
|
|
2390
2403
|
var _a, _b;
|
|
@@ -2393,7 +2406,7 @@ function useDollarState(specs) {
|
|
|
2393
2406
|
return;
|
|
2394
2407
|
}
|
|
2395
2408
|
var stateCell = getStateCellFrom$StateRoot($state, spec.pathObj);
|
|
2396
|
-
var newSpec =
|
|
2409
|
+
var newSpec = stateSpecs.find(function (sp) { return sp.path === spec.path; });
|
|
2397
2410
|
if (!newSpec ||
|
|
2398
2411
|
(stateCell.initFuncHash === ((_a = newSpec === null || newSpec === void 0 ? void 0 : newSpec.initFuncHash) !== null && _a !== void 0 ? _a : "") &&
|
|
2399
2412
|
stateCell.initialValue !== UNINITIALIZED)) {
|