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

fix useStoreMap in scope #474

Merged
merged 4 commits into from Mar 27, 2021
Merged

Conversation

sergeysova
Copy link
Collaborator

@sergeysova sergeysova commented Mar 26, 2021

import {Provider, useStoreMap} from 'effector-react/ssr'

const root = createDomain()

const $list = root.createStore([
  {id: 1, title: 'a'},
  {id: 2, title: 'b'},
])

const Link = ({id}) => {
  const item = useStoreMap({
    store: $list,
    keys: [id],
    fn: (list, [id]) => list.find(item => item.id === id),
  })

  return <div key={item.id}>{item.title}</div>
}
const scope = fork(root)

ReactDOM.render(
  <Provider value={scope}>
    <Link id={1} />
  </Provider>,
  document.getElementById('root')
)
t is undefined
exports.useStoreMap
ssr.js:1:4457

Repl

Report from user of effector-react v21.3.0

2021-03-26 15 05 58

@sergeysova sergeysova force-pushed the fix/use-store-map-read-store-of-undefined branch from 2167d49 to b044010 Compare March 26, 2021 12:18
@zerobias zerobias merged commit 7e34a4e into master Mar 27, 2021
@zerobias zerobias deleted the fix/use-store-map-read-store-of-undefined branch March 27, 2021 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants