File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+
2
+ import { IStoreState } from '../store' ;
3
+ import { updateProps , notifyObservers } from '../actions/index'
4
+
5
+ const observer : IStoreObserverDefinition < IStoreState > = {
6
+ observer : ( { dispatch, getState} ) => {
7
+ const clientSide_setProps = ( updates : { } ) => {
8
+ const { paths} = getState ( )
9
+ Object . entries ( updates ) . forEach ( ( [ componentId , props ] ) => {
10
+ const componentPath = paths . strs [ componentId ] ;
11
+ dispatch (
12
+ updateProps ( {
13
+ props,
14
+ itempath : componentPath
15
+ } )
16
+ ) ;
17
+ dispatch (
18
+ notifyObservers ( { id : componentId , props} )
19
+ ) ;
20
+ } ) ;
21
+ }
22
+
23
+
24
+ window . dash_clientside = window . dash_clientside || { } ;
25
+ window . dash_clientside [ 'clientSide_setProps' ] = clientSide_setProps
26
+ } ,
27
+ inputs : [ 'callbacks.executed' ]
28
+ } ;
29
+
30
+ export default observer ;
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import loadingMap from './observers/loadingMap';
15
15
import prioritizedCallbacks from './observers/prioritizedCallbacks' ;
16
16
import requestedCallbacks from './observers/requestedCallbacks' ;
17
17
import storedCallbacks from './observers/storedCallbacks' ;
18
+ import clientSide_setProps from './observers/clientSide_setProps' ;
18
19
19
20
export interface IStoreState {
20
21
callbacks : ICallbacksState ;
@@ -51,6 +52,7 @@ export default class RendererStore {
51
52
observe ( executingCallbacks ) ;
52
53
observe ( executedCallbacks ) ;
53
54
observe ( storedCallbacks ) ;
55
+ observe ( clientSide_setProps ) ;
54
56
} ) ;
55
57
56
58
private createAppStore = ( reducer : any , middleware : any ) => {
You can’t perform that action at this time.
0 commit comments