@@ -36,13 +36,13 @@ import {
3636} from '../types/callbacks' ;
3737import { isMultiValued , stringifyId , isMultiOutputProp } from './dependencies' ;
3838import { urlBase } from './utils' ;
39- import { getCSRFHeader , dispatchError } from '.' ;
39+ import { getCSRFHeader , dispatchError , setPaths } from '.' ;
4040import { createAction , Action } from 'redux-actions' ;
4141import { addHttpHeaders } from '../actions' ;
4242import { notifyObservers , updateProps } from './index' ;
4343import { CallbackJobPayload } from '../reducers/callbackJobs' ;
4444import { handlePatch , isPatch } from './patch' ;
45- import { getPath } from './paths' ;
45+ import { computePaths , getPath } from './paths' ;
4646
4747import { requestDependencies } from './requestDependencies' ;
4848
@@ -51,6 +51,7 @@ import {loadLibrary} from '../utils/libraries';
5151import { parsePMCId } from './patternMatching' ;
5252import { replacePMC } from './patternMatching' ;
5353import { loaded , loading } from './loading' ;
54+ import { getComponentLayout } from '../wrapper/wrapping' ;
5455
5556export const addBlockedCallbacks = createAction < IBlockedCallback [ ] > (
5657 CallbackActionType . AddBlocked
@@ -409,7 +410,30 @@ function sideUpdate(outputs: SideUpdateOutput, cb: ICallbackPayload) {
409410 return acc ;
410411 } , [ ] as any [ ] )
411412 . forEach ( ( [ id , idProps ] ) => {
413+ const state = getState ( ) ;
412414 dispatch ( updateComponent ( id , idProps , cb ) ) ;
415+
416+ const componentPath = getPath ( state . paths , id ) ;
417+ if ( ! componentPath ) {
418+ // Component doesn't exist, doesn't matter just allow the
419+ // callback to continue.
420+ return ;
421+ }
422+ const oldComponent = getComponentLayout ( componentPath , state ) ;
423+
424+ dispatch (
425+ setPaths (
426+ computePaths (
427+ {
428+ ...oldComponent ,
429+ props : { ...oldComponent . props , ...idProps }
430+ } ,
431+ [ ...componentPath ] ,
432+ state . paths ,
433+ state . paths . events
434+ )
435+ )
436+ ) ;
413437 } ) ;
414438 } ;
415439}
0 commit comments