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

React 18 #740

Closed
OlekRia opened this issue Apr 2, 2022 · 30 comments · Fixed by #769
Closed

React 18 #740

OlekRia opened this issue Apr 2, 2022 · 30 comments · Fixed by #769
Milestone

Comments

@OlekRia
Copy link

OlekRia commented Apr 2, 2022

After upgrading to react version 18, easy-peasy stopped working. When we call API it doesn't rerender a component which uses useStoreState hook.

@OlekRia
Copy link
Author

OlekRia commented Apr 10, 2022

@w3bdesign Oh, it's not about the typing... However, of course i am not acknowledge good with a source code. But the problem is that it doesn't work properly. It seems because react 18 becomes "asyncronous"

@benkissi
Copy link

Experiencing the same issue after changing to use reacts createRoot

Does not work
------------------------
const root = createRoot(document.getElementById("root"));
root.render(
  <React.StrictMode>
    <BrowserRouter>
      <StoreProvider store={store}>
        <App />
      </StoreProvider>
    </BrowserRouter>
  </React.StrictMode>
);
This works
-------------------

ReactDOM.render(
  <React.StrictMode>
    <StoreProvider store={store}>
      <BrowserRouter>
        <App />
      </BrowserRouter>
    </StoreProvider>
  </React.StrictMode>,
  document.getElementById("root")
);

@c-ctkd
Copy link

c-ctkd commented Apr 28, 2022

i have the same problem here. Alse using ReactDOM.render is not an optimal solution because we're missing all the new features introduced on react 18

@OlekRia
Copy link
Author

OlekRia commented Apr 28, 2022

i have the same problem here. Alse using ReactDOM.render is not an optimal solution because we're missing all the new features introduced on react 18

Am I guess... Seems this issue is not resolvable by easy-peasy ?

@codydeny
Copy link

codydeny commented May 5, 2022

using ReactDOM.render works.
Also, for me, it does not work only the in the development environment
but works fine when you build using npm run build
I am using
"easy-peasy": "5.0.4"
"react": "18.1.0"
"@types/react": "18.0.8"

@zawupf
Copy link

zawupf commented May 11, 2022

Removing React.StrictMode works for me, so that easy-peasy store updates are fired again.

@OlekRia
Copy link
Author

OlekRia commented May 11, 2022

Removing React.StrictMode works for me, so that easy-peasy store updates are fired again.

I guess the reason of existing React.Strict mode is quite respectful. I am afraid, your advice looks like not a solution.

@zawupf
Copy link

zawupf commented May 11, 2022

For sure that's just a workaround, until the underlying bug is fixed.

@geekact
Copy link

geekact commented May 18, 2022

For typescript users, you can try to use foca which support react 18 and type strong enough. Foca also based on redux + react-redux + immer

@OlekRia
Copy link
Author

OlekRia commented May 18, 2022

I don't use typescript. Because I am fed up with it. And I don't read Chinese. And don't get how a programmer may write a documentation using another language than English.

@geekact
Copy link

geekact commented May 18, 2022

I don't use typescript. Because I am fed up with it. And I don't read Chinese. And don't get how a programmer may write a documentation using another language than English.

@OlekRia @w3bdesign Yep, Chinese is not friendly for west countries, I just searched this framework today, and actually I think it's time to write English documentation since foca is great enough to show it to people who also love redux in the world.

@OlekRia
Copy link
Author

OlekRia commented May 18, 2022

You know. Modern React Toolkit isn't bad as well and mature.

@OlekRia
Copy link
Author

OlekRia commented May 18, 2022

Guys, thanks for your advertisement. But I am interested in easy-peasy.

@orbachar
Copy link

did you guys find a solution? im looking to upgrade react, but this is a showstopper.

@1alexvash
Copy link

@ctrlplusb any update on it?

@1alexvash
Copy link

Looking for an update, as while using next you can't really toggle strict mode, or any of the React 18 setup

@liamdefty
Copy link

@ctrlplusb Firstly, I love this lib. Use it on a few projects and it's helped me loads.

I'm keen to look at react 18 support, if it's something you don't have time for - is there any way I can help?

@juneroy1
Copy link

juneroy1 commented Aug 7, 2022

Hello everyone! I am having an issue in using easy-peasy in react 18, like for example when I change the value in the input it does not working properly the calling of api is not working also, can please help with this or am i the only experiencing this bug?

@larrykn
Copy link

larrykn commented Aug 15, 2022

Am also getting the same issue with easy-peasy in react 18

@Digital-Coder
Copy link

@ctrlplusb I would really love to use easy-peasy, maybe by any chance you could look into this bug ?

@apuatcfbd
Copy link

Looks like the library is dead. leaving...

@ctrlplusb
Copy link
Owner

Hi ya'll. I'm going to begin looking into React 18 support. My initial intuition is that this might constitute a breaking change. I'll look into how other popular state libraries are handling this transition.

@OlekRia
Copy link
Author

OlekRia commented Sep 15, 2022

@ctrlplusb Man... It's too late...

@ctrlplusb ctrlplusb pinned this issue Sep 15, 2022
@ctrlplusb
Copy link
Owner

ctrlplusb commented Sep 15, 2022

~ redacted this comment, as I figured out a breaking change isn't required ~

@ctrlplusb
Copy link
Owner

Ok, some good news. The React team released a shim which allows me to do backwards support for React 16 and 17.

I've done an initial integration and all the source tests are passing. 🎉

I still need to fix the TypeScript definitions, and also need to look into the SSR story as my initial read on this is that it may need additional work. Looking good thusfar.

If you are happy to be an alpha tester on this please ping in this issue.

@ctrlplusb
Copy link
Owner

Yeah, I definitely need to extend the provider to support SSR for React 18.

So if anyone is doing an SPA, please volunteer for alpha testing.

I'll ping when the SSR story is sorted for wider testing.

@ctrlplusb
Copy link
Owner

Screenshot 2022-09-15 at 23 57 22

😎

@ctrlplusb
Copy link
Owner

Ok ya'll. Anyone running an SPA, please could you test this alpha release;

yarn add easy-peasy@5.1.0-alpha.3

CodeSandbox Example

@ctrlplusb
Copy link
Owner

On face value the SSR support doesn't look difficult. We should be able to land this very soon if user feedback goes well in testing the alpha releases.

@rainerbruemmer
Copy link

rainerbruemmer commented Sep 16, 2022

Ok ya'll. Anyone running an SPA, please could you test this alpha release;

I have tested the alpha version and it works smoothly. Our store is not too small. It has many actions, thunks, thunkOns, computed states etc. The store keeps much data.

Thank you very much for restarting work on this very cool library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🏗 In progress
Development

Successfully merging a pull request may close this issue.