File tree Expand file tree Collapse file tree 1 file changed +3
-17
lines changed
Expand file tree Collapse file tree 1 file changed +3
-17
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ export function createStore(state, id = uuid()) {
3333function createState ( store , initialState ) {
3434 const setState = changes => {
3535 store . state = { ...store . state , ...changes }
36- store . subscriptions . forEach ( callback => callback ( store . state ) )
36+ store . subscriptions . forEach ( callback => callback ( changes ) )
3737 return true
3838 }
3939
@@ -95,24 +95,10 @@ export class Provider extends React.PureComponent {
9595 this . store . context = id ? createNamedContext ( id ) : ProviderContext
9696 }
9797
98- let internalState = this . store . state
99-
10098 // When a store was given,
101- // additional state is a different "initialState"
102- if ( store ) {
103- internalState = {
104- ...internalState ,
105- ...state ,
106- // TODO: Should this try to update the store?
107- // Changes to shadowed values in internal state won't propagate
108- // to the external store
109- ...wrapStateUpdateFunctions ( state , this , changes =>
110- this . setState ( changes )
111- ) ,
112- }
113- }
99+ // additional state could be different "initialState"
114100
115- this . state = internalState
101+ this . state = this . store . state
116102 this . unsubscribe = this . store . subscribe ( state => this . setState ( state ) )
117103 }
118104
You can’t perform that action at this time.
0 commit comments