@blocklet/pages-kit 0.6.34 → 0.6.35

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.
@@ -331,17 +331,14 @@ function usePreloadComponent({ instanceId, componentId, properties, locale, dev
331
331
  if (instanceId) {
332
332
  const key = [instanceId, realLocale].join('-');
333
333
  const componentState = (0, exports.customComponentStates)().getState();
334
- COMPONENT_LOADER_MAP[key] ??= Promise.resolve(componentState.getComponent({ componentId, locale: realLocale ?? dev?.defaultLocale ?? 'en' }) ??
335
- componentState.loadComponents({
336
- mode: dev?.mode,
337
- projectId: dev?.projectId ?? window.__PROJECT_ID__,
338
- locale: realLocale,
339
- instances: [{ id: instanceId, component: { id: componentId }, properties }],
340
- }));
341
- }
342
- // 如果前置 preload 已经触发过了,直接返回,不再触发下面的 /preload 逻辑
343
- if (previousRef.current) {
344
- return previousRef.current;
334
+ COMPONENT_LOADER_MAP[key] ??= componentState.loadComponents({
335
+ mode: dev?.mode,
336
+ projectId: dev?.projectId ?? window.__PROJECT_ID__,
337
+ locale: realLocale,
338
+ instances: [{ id: instanceId, component: { id: componentId }, properties }],
339
+ });
340
+ if (previousRef.current)
341
+ return previousRef.current;
345
342
  }
346
343
  return null;
347
344
  }