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

📦 Patch Redux + use RTK alpha for full ESM support #37

Merged
merged 1 commit into from
Mar 3, 2023

Conversation

QuintonC
Copy link
Collaborator

@QuintonC QuintonC commented Feb 28, 2023

ℹ️ What is the context for these changes?

Addresses an issue with Redux Toolkit and ESM support. When attempting to use the package in Next.js an error would be present stating addListener was not exported. This was primarily due to the lack of support for ESM usage in Redux Toolkit, which version 2 aims to resolve.

This makes use of an alpha package and a patch in order to remove an EmptyObject type from the Redux CombinedState type.

After chatting with some of the team from Redux, it appears the only "downside" to removing EmptyObject from the CombinedState type is that we must ensure that our initialState passed to combineReducers has all keys defined (which we already did anyway).

🕹️ Demonstration

State (w/ Demo) Image
Before SCR-20230302-n9k
After SCR-20230302-ng5

🎩 How can this be tophatted?

There are demo links on the demonstration :)

✅ Checklist

  • Tested on mobile N/A
  • Tested on multiple browsers N/A
  • Tested for accessibility N/A
  • Includes unit tests N/A
  • Updated relevant documentation for the changes (if necessary) N/A

@QuintonC QuintonC force-pushed the bugfix/redux-toolkit-webpack-support branch 5 times, most recently from b64d7b6 to 003349e Compare March 2, 2023 21:58
@QuintonC QuintonC changed the title 📦 Attempting to patch redux toolkit for webpack support 📦 Patch Redux + use RTK alpha for full ESM support Mar 2, 2023
@QuintonC QuintonC self-assigned this Mar 2, 2023
@Shopify Shopify deleted a comment from github-actions bot Mar 2, 2023
@Shopify Shopify deleted a comment from github-actions bot Mar 2, 2023
@Shopify Shopify deleted a comment from github-actions bot Mar 2, 2023
@Shopify Shopify deleted a comment from github-actions bot Mar 2, 2023
@Shopify Shopify deleted a comment from github-actions bot Mar 2, 2023
@QuintonC
Copy link
Collaborator Author

QuintonC commented Mar 2, 2023

/snapit

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2023

🫰✨ Thanks @QuintonC! Your snapshots have been published to npm.

Test the snapshots by updating your package.json with the newly published versions:

yarn add @shopify/connect-wallet@0.0.0-snapshot-20230302224907
yarn add @shopify/gate-context-client@0.0.0-snapshot-20230302224907
yarn add @shopify/tokengate@0.0.0-snapshot-20230302224907

@QuintonC QuintonC marked this pull request as ready for review March 2, 2023 22:56
Copy link
Contributor

@jamiely jamiely left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We paired on this and it seems fine, but how will we maintain this? Does it require documentation? Should there be some issue to look into this again a couple months from now?

Also, the codesandbox links open and I understand they are for next, but should we have some place to tophat our regular installation (non-next)?

Edit: After thinking about this, I figured I can just clone and test as usual.

@jamiely jamiely self-requested a review March 3, 2023 13:58
Copy link
Contributor

@jamiely jamiely left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tophatted on metamask desktop 👍

@caropinzonsilva
Copy link
Contributor

We paired on this and it seems fine, but how will we maintain this? Does it require documentation? Should there be some issue to look into this again a couple months from now?

Plus one on this. Do we know if it is going to get patched to the actual package in the future?

@QuintonC
Copy link
Collaborator Author

QuintonC commented Mar 3, 2023

We paired on this and it seems fine, but how will we maintain this? Does it require documentation? Should there be some issue to look into this again a couple months from now?

Plus one on this. Do we know if it is going to get patched to the actual package in the future?

@jamiely @caropinzonsilva great questions. From my understanding, this is actively being worked on by the folks over at Redux. The patch we're using here should be resolved when this PR is merged. If that PR doesn't get merged there's not any concern either as it's on the Redux team's active roadmap to remove the EmptyObject type intersection from my conversations with that team in the Reactiflux Discord.

@caropinzonsilva
Copy link
Contributor

Sound good! Can we create an issue for it? So that we don't totally forget about it :P

@QuintonC
Copy link
Collaborator Author

QuintonC commented Mar 3, 2023

Sound good! Can we create an issue for it? So that we don't totally forget about it :P

Yeah, of course! I'll get one created momentarily 🙌

Issue created! #46

@QuintonC QuintonC force-pushed the bugfix/redux-toolkit-webpack-support branch from 003349e to dfa32ad Compare March 3, 2023 20:08
@QuintonC QuintonC merged commit 3b7366f into main Mar 3, 2023
@QuintonC QuintonC deleted the bugfix/redux-toolkit-webpack-support branch March 3, 2023 20:12
@github-actions github-actions bot mentioned this pull request Mar 3, 2023
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants