Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server side rendering with getRunningOperationPromises #2477

Closed
JulienKode opened this issue Jul 1, 2022 · 6 comments
Closed

Server side rendering with getRunningOperationPromises #2477

JulienKode opened this issue Jul 1, 2022 · 6 comments
Labels
bug Something isn't working
Milestone

Comments

@JulienKode
Copy link
Contributor

JulienKode commented Jul 1, 2022

Hi

I've try to take a look at the ssr-experiment exemple here:

I've:

On the beedrill fetch this is what I can see when displaying running promises:

{
"getPokemonByName(\"beedrill\")": {
  "arg": "beedrill",
  "requestId": "070QxaL_aSi7MV3VbQzDQ",
  "queryCacheKey": "getPokemonByName(\"beedrill\")"
},
"getPokemonByName(\"bulbasaur\")": {
  "arg": "bulbasaur",
  "requestId": "FdsRw3PmBbDP5sR7-kKPe",
  "queryCacheKey": "getPokemonByName(\"bulbasaur\")"
}
}
  • Is it normal that we are waiting for bulbasaur when our page are just concern about beedrill ?
  • Should the runningPromises created in the api be unique to each page and not sharing across different page ? otherwise on large scale apps this could be an issue if we are waiting for the queries of another page
  • Does the runningPromises should be isolated to each page on SSR ?
  • like createListenerMiddleware should we have a createApiMiddleware ? Then on server side, we can have a different middleware instance for each page that does not share values

This is the debug line that I've added in redux:

  function getRunningOperationPromises() {
    console.warn("[DEBUG] RUNNING OPERATION PROMISES ", {runningQueries})
    console.warn(JSON.stringify(runningQueries, null, 2))

@phryneas @markerikson

@JulienKode JulienKode changed the title Server side rendering with Server side rendering with getRunningOperationPromises Jul 1, 2022
@phryneas phryneas added the bug Something isn't working label Jul 1, 2022
@phryneas
Copy link
Member

phryneas commented Jul 1, 2022

Good observation - this should be scoped per store instance. Could be difficult though as it is outside of a middleware 🤔

@phryneas
Copy link
Member

phryneas commented Jul 2, 2022

Could you give some feedback over in #2481 please?

@JulienKode
Copy link
Contributor Author

JulienKode commented Jul 4, 2022

@phryneas Thank you for taking care of it so quickly

@phryneas
Copy link
Member

phryneas commented Jul 4, 2022

This will still take some time until it makes in - we'll have to carefully weigh if and how we can break the existing implementation - since the new one would have to be dispatched. I know the old api was just plain wrong, but we'll have to discuss this quite a lot.

You can isntall the PR-patched package from the CodeSandbox registry in the meantime though.

@markerikson
Copy link
Collaborator

Marking this as done because it's in 1.9 beta.

@JulienKode
Copy link
Contributor Author

Thank you @markerikson @phryneas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants