Skip to content

Commit

Permalink
add remove component update
Browse files Browse the repository at this point in the history
  • Loading branch information
maxence-charriere committed Aug 11, 2022
1 parent 8929c1e commit 185f470
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/app/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ func (c *Compo) updateWith(v UI) error {
Tag("new", reflect.TypeOf(v))
}

// defer c.getDispatcher().preventComponentUpdate(c.this)
defer c.getDispatcher().removeComponentUpdate(c.this)

aval := reflect.Indirect(reflect.ValueOf(c.self()))
bval := reflect.Indirect(reflect.ValueOf(v))
Expand Down
1 change: 1 addition & 0 deletions pkg/app/dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ type Dispatcher interface {
isServerSide() bool
resolveStaticResource(string) string
preventComponentUpdate(Composer)
removeComponentUpdate(Composer)
}

// ClientDispatcher is the interface that describes a dispatcher that emulates a
Expand Down
4 changes: 4 additions & 0 deletions pkg/app/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,10 @@ func (e *engine) preventComponentUpdate(c Composer) {
e.componentUpdates[c] = false
}

func (e *engine) removeComponentUpdate(c Composer) {
delete(e.componentUpdates, c)
}

func (e *engine) addDeferable(d Dispatch) {
e.deferables = append(e.deferables, d)
}
Expand Down

0 comments on commit 185f470

Please sign in to comment.