Giter VIP home page Giter VIP logo

ssr-experiments's People

Contributors

phryneas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ssr-experiments's Issues

Is this still "the way"?

A lot has changed with Next and RTK in the past 5 months. Is this still the recommended way?

use hydration. still behaves wonky - middleware not executed on client?

That commit message is a little off-putting, too :P

Does the caching strategy still work on the server and do I still need to call the hooks to query data.

Hello @phryneas first of all, thanks for the amazing work you and your team do.
I see how helpful your comments are all over the web.

I'm a bit confused when it comes to using RTK query during SSR, particularly using Next.js.

I have seen in this repo that even with the use of RTK query during SSR, you still make use of the hooks to fetch for the Pokemon details in the Pokemon page.

Because of that, I have multiple questions -

  • Do I still need the hook to fetch/query data even even while using RTK query server side ?
  • While using SSR, is the data still stored in the cache ?
  • If the data is still stored in the cache and not run on every request, meaning I can still get the cached data from the query hook right ?

Please I would really appreciate your response.
Thanks @phryneas

can you please make this example in normal js instead of typescript ?

@phryneas
I try to convert this into normal js but I don't how to convert this part

# store.ts
export type AppStore = ReturnType<typeof makeStore>;
export type RootState = ReturnType<AppStore["getState"]>;
export type AppDispatch = AppStore["dispatch"];

and this part where is this

util: { getRunningOperationPromises }

defined ?

# pokemonApi.ts

// Export hooks for usage in functional components
export const {
  useGetPokemonByNameQuery,
  useGetPokemonListQuery,
  util: { getRunningOperationPromises },
} = pokemonApi;

getting getRunningQueriesThunk() is not a function during SSR

I'm trying to run rtkQuery during SSR, all goes well until it gets to dispatching the getRunningQueriesThunk and I get the following function TypeError: _features_api_subApis_propertyApi__WEBPACK_IMPORTED_MODULE_4__.propertyApi.util.getRunningQueriesThunk is not a function

export const getServerSideProps = reduxWrapper.getServerSideProps(
  (store) => async (context) => {
    const propertyId = context.params?.propertyId;

    store.dispatch(getProperty.initiate(propertyId));

    const response = await Promise.all(
      store.dispatch(propertyApi.util.getRunningQueriesThunk())
    );
    console.log(response);

    return {
      props: {},
    };
  }
);

I have tried looking for solution online, but I found none,
When I check the methods/functions of the api.util, I see the old getRunningOperationPromises and cannot find getRunningQueriesThunk
Please how can I solve this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.