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

[minor]: fix props passing when redux load subapp is used #1953

Merged
merged 2 commits into from
Mar 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions packages/subapp-redux/src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ setStoreContainer(window);
//
export function reduxRenderStart(options) {
const store = options._store || options.reduxCreateStore(options.initialState);
const { Component } = options;
const { Component, props } = options;

if (options.serverSideRendering) {
hydrateRoot(options.element,
<Provider store={store}>
<Component />
<Component {...props} />
</Provider>
);
} else {
createRoot(options.element).render(
<Provider store={store}>
<Component />
<Component {...props} />
</Provider>
);
}
Expand All @@ -43,14 +43,16 @@ export function reduxLoadSubApp(info) {
const initialState = instance._prepared || instance.initialState;
const reduxCreateStore = instance.reduxCreateStore || this.info.reduxCreateStore;
const Component = this.info.StartComponent || this.info.Component;
const props = instance.props || {}

const store = reduxRenderStart({
_store: instance._store,
initialState,
reduxCreateStore,
Component,
serverSideRendering: instance.serverSideRendering,
element
element,
props
});

instance._store = store;
Expand Down