@snowcone-app/ui 0.10.14 → 0.10.15
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 +11 -0
- package/dist/index.cjs +3 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/personalization/PersonalizationProvider.tsx +7 -3
- package/src/personalization/__tests__/PersonalizationProvider.canvas-import.test.tsx +35 -0
package/dist/index.d.cts
CHANGED
|
@@ -5604,7 +5604,8 @@ interface PersonalizationProviderProps {
|
|
|
5604
5604
|
} | null;
|
|
5605
5605
|
/**
|
|
5606
5606
|
* Lazy import for `@snowcone-app/canvas`. Runs in the consumer's webpack context
|
|
5607
|
-
* so module resolution works even though this package doesn't depend on canvas.
|
|
5607
|
+
* so module resolution works even though this package doesn't depend on canvas. Called only when `fields` is
|
|
5608
|
+
* non-empty: a product without personalization never loads the canvas.
|
|
5608
5609
|
*
|
|
5609
5610
|
* @example `canvasImport={() => import("@snowcone-app/canvas")}`
|
|
5610
5611
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -5604,7 +5604,8 @@ interface PersonalizationProviderProps {
|
|
|
5604
5604
|
} | null;
|
|
5605
5605
|
/**
|
|
5606
5606
|
* Lazy import for `@snowcone-app/canvas`. Runs in the consumer's webpack context
|
|
5607
|
-
* so module resolution works even though this package doesn't depend on canvas.
|
|
5607
|
+
* so module resolution works even though this package doesn't depend on canvas. Called only when `fields` is
|
|
5608
|
+
* non-empty: a product without personalization never loads the canvas.
|
|
5608
5609
|
*
|
|
5609
5610
|
* @example `canvasImport={() => import("@snowcone-app/canvas")}`
|
|
5610
5611
|
*/
|
package/dist/index.js
CHANGED
|
@@ -15197,9 +15197,10 @@ function PersonalizationProvider({
|
|
|
15197
15197
|
const [BridgeComponent, setBridgeComponent] = useState46(
|
|
15198
15198
|
cachedBridgeComponent
|
|
15199
15199
|
);
|
|
15200
|
+
const hasFields = fields.length > 0;
|
|
15200
15201
|
useEffect47(() => {
|
|
15201
15202
|
if (CanvasComponent && BridgeComponent) return;
|
|
15202
|
-
if (!canvasImport) return;
|
|
15203
|
+
if (!canvasImport || !hasFields) return;
|
|
15203
15204
|
if (!canvasLoadPromise) {
|
|
15204
15205
|
canvasLoadPromise = canvasImport().then((mod) => {
|
|
15205
15206
|
cachedCanvasComponent = mod.SnowconeCanvas || mod.default;
|
|
@@ -15214,7 +15215,7 @@ function PersonalizationProvider({
|
|
|
15214
15215
|
setBridgeComponent(() => cachedBridgeComponent);
|
|
15215
15216
|
}
|
|
15216
15217
|
});
|
|
15217
|
-
}, [CanvasComponent, BridgeComponent, canvasImport]);
|
|
15218
|
+
}, [CanvasComponent, BridgeComponent, canvasImport, hasFields]);
|
|
15218
15219
|
const realtimeEnabledRef = useRef30(false);
|
|
15219
15220
|
useEffect47(() => {
|
|
15220
15221
|
return () => {
|