Skip to content

Commit

Permalink
fix: onInit selectors uses parsedOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
adrian-marcelo-gallardo committed Mar 26, 2020
1 parent 45904b2 commit 7641026
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ Note that, if provided, `onInit` function will be triggered only once when the P
// index.tsx

const selectionOption = {
actions: ['fetchTodos'],
actionSelectors: ['fetchTodos'],
}

const onInit({ fetchTodos }) => fetchTodos();
Expand Down
6 changes: 3 additions & 3 deletions src/createContextProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ function createContextProvider(...args: any[]): CreateContextProviderReturn {
parsedOptions.stateSelectors = parseSelectors(parsedOptions.stateSelectors);
parsedOptions.actionSelectors = parseSelectors(parsedOptions.actionSelectors);

const selectedState = selectValues(options.stateSelectors, state, props);
const selectedActions = selectValues(options.actionSelectors, actions, props);
const mergedProps = getMergedProps(selectedState, selectedActions, props, options.computedSelectors);
const selectedState = selectValues(parsedOptions.stateSelectors, state, props);
const selectedActions = selectValues(parsedOptions.actionSelectors, actions, props);
const mergedProps = getMergedProps(selectedState, selectedActions, props, parsedOptions.computedSelectors);

onInitFn(mergedProps);
}, []);
Expand Down

0 comments on commit 7641026

Please sign in to comment.