@blocklet/pages-kit 0.2.219 → 0.2.220

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.
@@ -164,6 +164,7 @@ function useComponent({ mode, instanceId, componentId, components, locale, defau
164
164
  return (_b = (_a = PRELOAD_COMPONENTS_STATE === null || PRELOAD_COMPONENTS_STATE === void 0 ? void 0 : PRELOAD_COMPONENTS_STATE.props[instanceId]) === null || _a === void 0 ? void 0 : _a.locales) === null || _b === void 0 ? void 0 : _b[defaultLocale];
165
165
  }, [instanceId, locale, PRELOAD_COMPONENTS_STATE_KEY]);
166
166
  const previousPreload = (0, react_1.useRef)();
167
+ const [, update] = (0, react_1.useState)(0);
167
168
  if ((props || preloadState) && preloadComponent) {
168
169
  previousPreload.current = {
169
170
  Component: preloadComponent.Component,
@@ -172,7 +173,9 @@ function useComponent({ mode, instanceId, componentId, components, locale, defau
172
173
  return previousPreload.current;
173
174
  }
174
175
  if (!(components === null || components === void 0 ? void 0 : components.length) && preloadComponent) {
175
- loadRemoteComponent({ mode, instanceId, componentId, locale: locale || defaultLocale });
176
+ loadRemoteComponent({ mode, instanceId, componentId, locale: locale || defaultLocale }).then(() => {
177
+ update(PRELOAD_COMPONENTS_STATE_KEY);
178
+ });
176
179
  if (previousPreload.current) {
177
180
  return previousPreload.current;
178
181
  }
@@ -137,6 +137,7 @@ function useComponent({ mode, instanceId, componentId, components, locale, defau
137
137
  return (_b = (_a = PRELOAD_COMPONENTS_STATE === null || PRELOAD_COMPONENTS_STATE === void 0 ? void 0 : PRELOAD_COMPONENTS_STATE.props[instanceId]) === null || _a === void 0 ? void 0 : _a.locales) === null || _b === void 0 ? void 0 : _b[defaultLocale];
138
138
  }, [instanceId, locale, PRELOAD_COMPONENTS_STATE_KEY]);
139
139
  const previousPreload = useRef();
140
+ const [, update] = useState(0);
140
141
  if ((props || preloadState) && preloadComponent) {
141
142
  previousPreload.current = {
142
143
  Component: preloadComponent.Component,
@@ -145,7 +146,9 @@ function useComponent({ mode, instanceId, componentId, components, locale, defau
145
146
  return previousPreload.current;
146
147
  }
147
148
  if (!(components === null || components === void 0 ? void 0 : components.length) && preloadComponent) {
148
- loadRemoteComponent({ mode, instanceId, componentId, locale: locale || defaultLocale });
149
+ loadRemoteComponent({ mode, instanceId, componentId, locale: locale || defaultLocale }).then(() => {
150
+ update(PRELOAD_COMPONENTS_STATE_KEY);
151
+ });
149
152
  if (previousPreload.current) {
150
153
  return previousPreload.current;
151
154
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/pages-kit",
3
- "version": "0.2.219",
3
+ "version": "0.2.220",
4
4
  "description": "Pages Kit components and utils",
5
5
  "publishConfig": {
6
6
  "access": "public"