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.

Issue with v8.0 of library

See original GitHub issue

Describe the bug

I’m having an issue with the latest version of the library. v8.0 The new version somehow reset the state(or it stays empty as the initial state) during navigation only. when I visit the page through a URL or a hard refresh this is not an issue I get the expected state. but when navigating the client side my app just crashes cause of an empty state.

To Reproduce

Steps to reproduce the behavior:

  1. Have an app with multiple pages
  2. Navigate to the second page which is using getStaticProps or getServerSideProps
  3. Empty state error

Expected behavior

Reverting back to version 7.0.5 fixed the issue.

Desktop (please complete the following information):

  • Browser Chrome
  • Version WIN 10

Additional context

Dependencies I’m using:

  "@reduxjs/toolkit": "^1.8.5",
  "next": "^12.3.1",
  "next-with-less": "^2.0.5",
  "react": "18.2.0",
  "react-dom": "18.2.0",
  "react-fast-compare": "^3.2.0",
  "react-icons": "^4.4.0",
  "react-redux": "^8.0.4",

Thanks!

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:4
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Oseincommented, Oct 19, 2022

When i upgrade to v8 this happens on my project too, reverted back to v7

0reactions
rsagievcommented, Dec 25, 2022

I make my own version of wrapper store.js

let store;
let prev = null;

const makeStore = (preloadedState) => {
  return configureStore({
    reducer: {
      main: mainReducer,
      home: homeReducer,
      viewport: viewportReducer,
      blog: blogReducer,
      portfolio: portfolioReducer,
      pages: pagesReducer
    },
    preloadedState: mergeDeep(initialState, preloadedState),
    devTools: process.env.NODE_ENV !== 'production'
  });
};

export const getStore = (preloadedState) => {
  if (typeof window === 'undefined') return makeStore(preloadedState); // for SSR

  if (!store) {
    store = makeStore(preloadedState);
  } else {
    if (prev !== preloadedState && preloadedState) {
      store.dispatch({
        type: 'HYDRATE',
        payload: preloadedState,
      });
      prev = preloadedState;
      console.log('after hydrate', store.getState());
    }
  }

  return store;
};

_app.js

const MyApp = ({ Component, pageProps }) => {
  const { initialState, ...restPageProps } = pageProps;
  const store = getStore(initialState);
  const router = useRouter();

  return (
    <>
      <Provider store={store}>
        <Component {...restPageProps} />
      </Provider>
    </>
  );
};
Read more comments on GitHub >

github_iconTop Results From Across the Web

Industry Library V8.0 Block Issues - 117431
I've been working with the functions library meant to be used in PCS7 called "Indutry Library" v8.0. I am doing a study to...
Read more >
Fix list for IBM WebSphere Application Server V8.0
The following is a complete listing of fixes for V8.0 with the most ... PM06023, Problem when commons-el and java stand tag library...
Read more >
Having trouble locating `v8_base` while attempting to update ...
The issue I'm having is that when I change the version indicated in the build script I encounter a build error complaining about...
Read more >
V8 Causing Shiny Crash · Issue #119 · jeroen/V8 - GitHub
Rendering plots that call V8 in shiny are either not working or completely crashing shiny. Verified by the shiny team with reproducible ...
Read more >
6 - Chrome/V8 breaks Prototype JavaScript library - Monorail
Issue 6: Chrome/V8 breaks Prototype JavaScript library ... 1230:0 --- In Chrome, I got this: --- 1230:0 1100:1 1150:0,1 --- var a =...
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