question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Server side rendering with getRunningOperationPromises

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
phryneascommented, Jul 1, 2022

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

2reactions
phryneascommented, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Server Side Rendering - Redux Toolkit
RTK Query supports Server Side Rendering (SSR) with Next.js via rehydration in combination with next-redux-wrapper.
Read more >
Server-Side Rendering - Redux Toolkit Query
Server Side Rendering · Pre-fetch all queries via the initiate actions, e.g. store.dispatch(api.endpoints.getPokemonByName.initiate(name)) · Wait ...
Read more >
Server-side rendering - Apollo GraphQL Docs
Server -side rendering (SSR) is a performance optimization for modern web apps. It enables you to render your app's initial state to raw...
Read more >
Server-side Rendering | urql Documentation
On the server-side it's able to gather all results as they're being fetched, which can then be serialized and sent to the client....
Read more >
Server-Side Rendering - Stitches.dev
How to configure server-side rendering. You can get access to the CSS string by using the getCssText function. This function is made available...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found