-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
feat: new extension vike-react-redux
(closes #87)
#161
base: main
Are you sure you want to change the base?
Conversation
Neat! Let me know when you want me to have a look at it. |
d1198b3
to
c1b481a
Compare
I think the basic integration is good enough, but I’m not too familiar with more complex use cases. Let me know what you think. I’ll polish the README once we’ve covered everything. |
vike-react-redux
vike-react-redux
(fix #87)
vike-react-redux
(fix #87)vike-react-redux
(closes #87)
}, | ||
"peerDependencies": { | ||
"@reduxjs/toolkit": ">=2", | ||
"react-redux": ">=9", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we define react-redux
and @reduxjs/toolkit
as both dependency
and peerDependencies
? Rationale: vikejs/vike#2070. Making vike-react-redux
even more zero config ✨
"typescript": "^5.5.3", | ||
"vike": "^0.4.211", | ||
"vike-react": "^0.5.12", | ||
"vite": "^5.4.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need vite
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Intervention++
if (pageContext.config.redux) { | ||
const createStore = pageContext.config.redux.createStore | ||
if (createStore) { | ||
pageContext.config.redux.store = createStore() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless we have a reason, let's try to treat pageContext.config
as immutable.
How about this?
pageContext.reduxStore
pageContext.reduxState
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The store
contains functions, so when we try to access it on the client side, it can't be serialized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know, that's why I'm suggesting two different pageContext
props.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Note that I didn't Intervention++
because I did guess that you mutated pageContext.config
because of passToClient
😉)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, are you suggesting we do it like this ?
pageContext.reduxStore
for the client-sidepageContext.config.redux.store
for server-side
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should work if we use pageContext.reduxStore
for both client- and server-side without adding it to passToClient
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, thank you. Sorry, I didn't know
The overall integration LGTM! Very exciting, |
Didn't look at the README, let me know when you want me to. |
How about we create an example for this |
Just pushed a |
#87