Skip to content

There is unnecessary loading when using createLazyComponent & ssr #4021

@Ives7

Description

@Ives7

Describe the bug

When I use modern.js and createLazyComponent in ssr mode, my component has a fetchData, the loading content will appear once no matter what. In fact, the server has been fully loaded, which will cause the page to flash once. I am not sure if this is a bug. If not, I will close this issue. Thank you very much.

Like that:

const Footer = instance.createLazyComponent({
	loader: () => import("@mfe-components/footer"),
	loading: "loading",
	export: "Footer",
	fallback: "fallback",
});

Reproduction

just use createLazyComponent with modernjs ssr mode ,and export a xxx.data.ts

Used Package Manager

npm

System Info

System:
    OS: macOS 15.6
    CPU: (10) arm64 Apple M4
    Memory: 189.44 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.4.1 - ~/.local/state/fnm_multishells/8240_1755686939168/bin/node
    npm: 11.4.2 - ~/.local/state/fnm_multishells/8240_1755686939168/bin/npm
    pnpm: 10.15.0 - ~/.local/state/fnm_multishells/8240_1755686939168/bin/pnpm
    bun: 1.2.20 - ~/.bun/bin/bun
  Browsers:
    Chrome: 139.0.7258.139
    Safari: 18.6

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions