diff --git a/.changeset/curvy-stars-kneel.md b/.changeset/curvy-stars-kneel.md new file mode 100644 index 0000000000..78449d08f6 --- /dev/null +++ b/.changeset/curvy-stars-kneel.md @@ -0,0 +1,13 @@ +--- +"@lynx-js/web-core": patch +--- + +chore: mark the "multi-thread" deprecated + +**NOTICE This will be a breaking change in the future** + +mark the thread strategy "multi-thread" as deprecated. + +Please use "all-on-ui" instead. If you still want to use multi-thread mode, please try to use a cross-origin isolated iframe. + +A console warning will be printed if `thread-strategy` is set to `multi-thread`. diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index aec21ba061..52d6611738 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -87,12 +87,12 @@ jobs: strategy: fail-fast: false matrix: - thread: [MULTI_THREAD, ALL_ON_UI] + thread: [ALL_ON_UI] render: [SSR, CSR] shard: [1, 2, 3, 4] - exclude: - - thread: MULTI_THREAD - render: SSR + # exclude: + # - thread: MULTI_THREAD + # render: SSR with: runs-on: lynx-custom-container is-web: true diff --git a/packages/web-platform/web-core/src/apis/LynxView.ts b/packages/web-platform/web-core/src/apis/LynxView.ts index e7fa3ad839..90a2111fa9 100644 --- a/packages/web-platform/web-core/src/apis/LynxView.ts +++ b/packages/web-platform/web-core/src/apis/LynxView.ts @@ -54,7 +54,6 @@ export type INapiModulesCall = ( * @property {"false" | "true" | null} injectHeadLinks [optional] (attribute: "inject-head-links") @default true set it to "false" to disable injecting the styles into shadowroot * @property {string[]} injectStyleRules [optional] the css rules which will be injected into shadowroot. Each items will be inserted by `insertRule` method. @see https://developer.mozilla.org/docs/Web/API/CSSStyleSheet/insertRule * @property {number} lynxGroupId [optional] (attribute: "lynx-group-id") the background shared context id, which is used to share webworker between different lynx cards - * @property {"all-on-ui" | "multi-thread"} threadStrategy [optional] @default "multi-thread" (attribute: "thread-strategy") controls the thread strategy for current lynx view * @property {(string)=>Promise} customTemplateLoader [optional] the custom template loader, which is used to load the template * @property {InitI18nResources} initI18nResources [optional] (attribute: "init-i18n-resources") the complete set of i18nResources that on the container side, which can be obtained synchronously by _I18nResourceTranslation * @@ -344,6 +343,7 @@ export class LynxView extends HTMLElement { /** * @param * @property + * @deprecated multi-thread is deprecated, please use "all-on-ui" instead. If you still want to use multi-thread mode, please try to use a cross-origin isolated iframe. */ get threadStrategy(): 'all-on-ui' | 'multi-thread' { // @ts-expect-error @@ -431,6 +431,11 @@ export class LynxView extends HTMLElement { const threadStrategy = (this.threadStrategy ?? 'all-on-ui') as | 'all-on-ui' | 'multi-thread'; + if (threadStrategy === 'multi-thread') { + console.warn( + `[LynxView] multi-thread strategy is deprecated, please use "all-on-ui" instead. If you still want to use multi-thread mode, please try to use a cross-origin isolated iframe.`, + ); + } const lynxView = createLynxView({ threadStrategy, tagMap,