Skip to content

solid / start : createAsync/createResource mixes results when run server side, when component has "unstable" execution. due to secondary rerun of the suspended component. #2517

@mizulu

Description

@mizulu

Describe the bug

createAsync/createResource mixes results when run server side, when component has "unstable" execution. due to secondary rerun of the suspended component. and incorrect mapping.

Your Example Website or App

https://stackblitz.com/edit/github-52yqwfhu-kryvpmtc?file=src%2Froutes%2Fx.tsx,src%2Froutes%2Fabout.tsx

Steps to Reproduce the Bug or Issue

  1. go directly to the /about in the browser not via the link
  2. observe the logs

Expected behavior

  if (shouldRedirect()) {
    console.log('LATER');
    console.log('A:', aAsy()); // expected "A: a"  actual "A: b"
    console.log('B:', bAsy()); // expected "B: b"  actual "B: a"
  } else {
    console.log('INITIAL');

    console.log('A:', aAsy()); // should be undefined
    console.log('B:', bAsy()); // should be undefined
  }

Screenshots or Videos

msedge_QeCu93gKAj.mp4

Platform

online playground

Additional context

  if (shouldRedirect()) {
    // later
    // if we flip back the order it will become stable again
    aAsy = createAsync(() => a());
    bAsy = createAsync(() => b());
    // bAsy = createAsync(() => b());
    // aAsy = createAsync(() => a());
  } else {
    // initial
    bAsy = createAsync(() => b());
    aAsy = createAsync(() => a());
  }

solid re runs the suspended component
on the 2nd run it tries to match the results based on the original (initial)
order of requests.

because we flip the createAsync order on the "later" phase
the results are matched incorrectly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions