File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -143,6 +143,10 @@ export default class ModelManager {
143143 viewList . push ( { name, id : this . nextViewId ++ } ) ;
144144 this . data = assignObjKey ( this . data , viewName , viewList ) ;
145145 this . activateView ( viewName , index ) ;
146+ // generate data model for new view (...using a get method with side-effects...)
147+ this . getPropertyList ( ) ;
148+ this . runHooks ( ) ;
149+ this . invokeListeners ( ) ;
146150 }
147151
148152 // --------
@@ -184,17 +188,26 @@ export default class ModelManager {
184188 newData . value
185189 ) ;
186190
187- const hooks = this . model . views [ this . activeViewName ] . hooks || [ ] ;
188- hooks . forEach ( ( hook ) =>
189- HookManager . applyHook ( hook , this . fullData , viewData , this . model )
190- ) ;
191-
191+ this . runHooks ( ) ;
192192 this . invokeListeners ( ) ;
193193 }
194194 }
195195
196196 // --------
197197
198+ runHooks ( viewName = null , viewIndex = null ) {
199+ const name = viewName || this . activeViewName ;
200+ const index = viewIndex || this . activeViewIndex ;
201+
202+ const viewData = this . data [ name ] [ index ] ;
203+ const hooks = this . model . views [ name ] . hooks || [ ] ;
204+ hooks . forEach ( ( hook ) =>
205+ HookManager . applyHook ( hook , this . fullData , viewData , this . model )
206+ ) ;
207+ }
208+
209+ // --------
210+
198211 getPropertyList ( ) {
199212 const propertyList = [ ] ;
200213
You can’t perform that action at this time.
0 commit comments