Skip to content

All routes are chunked, causing hydration of prerendered pages to flicker #281

@ajoslin

Description

@ajoslin

It appears that all routes are being chunked and async loaded, even without the presence of the async! prefix.

I've reproduced this using preact-cli 1.4.1 here: https://github.com/ajoslin/preact-cli-issue-all-routes-chunked. Just build and serve and check the network tab, it loads both bundle and route-home.chunk. And it does a render before the home chunk is loaded.

Details

I have a prerendered homepage. Here's the process when the user visits the site:

  1. Index.html loads with prerendered content
  2. Main JS bundle loads
    • Initial render is triggered without the home component downloaded
    • Bundle begins downloading route-home.chunk.js
  3. Wait for route-home.chunk.js is loaded
  4. Home route chunk loads and the home content renders

Between (2) and (4), a version of the app is rendered that does not include the home route's content, because the home route's JS is still loading.

This results in a noticeable "flicker" of the home content being removed then re-appearing as soon as the initial bundle loads.

I'm not using the async! prefix when importing my home route, but it looks like the home route is being chunked anyway.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions