Race condition

Author: katsu223Created Jul 2, 2024Updated Jul 2, 2024

Bug Report

Race condition while loading chunk

To Reproduce

Basically need to render AsyncPage and change path until chunk is fully loaded. This will lead to race condition - chunk from request will be rendered regardless of path in props.

Real world usage:

  1. Slow internet speed and fast route change.
  2. Programmatically redirect

Expected behavior

If path props is changed, proper chunk must be rendered, pending requests should be skipped.

Link to repl or repo (highly encouraged)

https://codesandbox.io/p/sandbox/xenodochial-waterfall-rgl9d4

Run npx envinfo --system --binaries --npmPackages @loadable/component,@loadable/server,@loadable/webpack-plugin,@loadable/babel-plugin --markdown --clipboard

Paste the results here: locally:

bash
## System:
 - OS: macOS 14.5
 - CPU: (10) arm64 Apple M1 Pro
 - Memory: 67.88 MB / 32.00 GB
 - Shell: 5.9 - /bin/zsh
## Binaries:
 - Node: 16.17.0 - ~/.nodenv/versions/16.17.0/bin/node
 - Yarn: 1.22.19 - ~/.nodenv/versions/16.17.0/bin/yarn
 - npm: 8.15.0 - ~/.nodenv/versions/16.17.0/bin/npm
## npmPackages:
 - @loadable/component: ^5.16.4 => 5.16.4

on codesandbox:

bash

## System:
 - OS: Linux 6.1 Debian GNU/Linux 12 (bookworm) 12 (bookworm)
 - CPU: (2) x64 AMD EPYC
 - Memory: 2.25 GB / 4.01 GB
 - Container: Yes
 - Shell: Unknown
## Binaries:
 - Node: 20.9.0 - /usr/local/bin/node
 - Yarn: 1.22.19 - /usr/local/bin/yarn
 - npm: 9.8.1 - /usr/local/bin/npm
 - pnpm: 8.10.2 - /usr/local/share/npm-global/bin/pnpm
## npmPackages:
 - @loadable/component: 5.16.4 => 5.16.4 

Source: gregberge/loadable-components