App updates automatically after constructing UI
Before, a backend had to implement the update right after the construction of the UI manually
This commit is contained in:
parent
0e2595e2d4
commit
ed46533740
@ -45,6 +45,7 @@ extension App {
|
||||
for element in app.scene where element is Storage.SceneElementType {
|
||||
element.setupInitialContainers(app: app.app)
|
||||
}
|
||||
StateManager.updateViews(force: true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -29,7 +29,12 @@ extension AppStorage {
|
||||
/// Focus the scene element with a certain id (if supported). Create the element if it doesn't already exist.
|
||||
/// - Parameter id: The element's id.
|
||||
public func showSceneElement(_ id: String) {
|
||||
storage.sceneStorage.last { $0.id == id && !$0.destroy }?.show() ?? addSceneElement(id)
|
||||
guard let storage = storage.sceneStorage.last(where: { $0.id == id && !$0.destroy }) else {
|
||||
addSceneElement(id)
|
||||
StateManager.updateViews(force: true)
|
||||
return
|
||||
}
|
||||
storage.show()
|
||||
}
|
||||
|
||||
/// Add a new scene element with the content of the scene element with a certain id.
|
||||
@ -39,6 +44,7 @@ extension AppStorage {
|
||||
let container = element.container(app: self)
|
||||
storage.sceneStorage.append(container)
|
||||
showSceneElement(id)
|
||||
StateManager.updateViews(force: true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -143,7 +143,6 @@ extension Widget {
|
||||
) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(initializeWidget())
|
||||
initProperties(storage, data: data, type: type)
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
return storage
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user