Skip to content

Commit e8c1f9d

Browse files
fix(overmind-devtools-client): use the correct provider approach
1 parent 0e27dd1 commit e8c1f9d

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

packages/node_modules/overmind-devtools-client/src/index.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import { injectGlobal } from 'emotion'
2-
import { render } from 'react-dom'
2+
import { createOvermind } from 'overmind'
3+
import { Provider } from 'overmind-react'
34
import { createElement } from 'react'
5+
import { render } from 'react-dom'
6+
47
import Devtools from './components/Devtools'
5-
import { overmind } from './overmind'
8+
import { config } from './overmind'
69
import { css } from './theme'
710

811
injectGlobal`
@@ -62,7 +65,16 @@ window.onerror = (_, _2, _3, _4, error) => {
6265
overmind.actions.setError(error.message)
6366
}
6467

68+
const overmind = createOvermind(config, {
69+
devtools: false,
70+
})
71+
6572
const container = document.createElement('div')
6673
container.id = 'app'
6774
document.body.appendChild(container)
68-
render(<Devtools />, container)
75+
render(
76+
<Provider value={overmind}>
77+
<Devtools />
78+
</Provider>,
79+
container
80+
)
Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { Overmind, IConfig } from 'overmind'
1+
import { IConfig, Overmind } from 'overmind'
22
import { createHook } from 'overmind-react'
33

44
import * as actions from './actions'
55
import * as effects from './effects'
6-
import state from './state'
76
import onInitialize from './onInitialize'
7+
import state from './state'
88

9-
const config = {
9+
export const config = {
1010
onInitialize,
1111
effects,
1212
actions,
@@ -17,8 +17,4 @@ declare module 'overmind' {
1717
interface Config extends IConfig<typeof config> {}
1818
}
1919

20-
export const overmind = new Overmind(config, {
21-
devtools: false,
22-
})
23-
24-
export const useOvermind = createHook(overmind)
20+
export const useOvermind = createHook<typeof config>()

0 commit comments

Comments
 (0)