fix: Scene lookup failing when looking up by id (#5542)
This commit is contained in:
parent
45b592227d
commit
93cccd596a
@ -29,9 +29,14 @@ class Scene {
|
|||||||
|
|
||||||
static mapElementToScene(elementKey: ElementKey, scene: Scene) {
|
static mapElementToScene(elementKey: ElementKey, scene: Scene) {
|
||||||
if (isIdKey(elementKey)) {
|
if (isIdKey(elementKey)) {
|
||||||
|
// for cases where we don't have access to the element object
|
||||||
|
// (e.g. restore serialized appState with id references)
|
||||||
this.sceneMapById.set(elementKey, scene);
|
this.sceneMapById.set(elementKey, scene);
|
||||||
} else {
|
} else {
|
||||||
this.sceneMapByElement.set(elementKey, scene);
|
this.sceneMapByElement.set(elementKey, scene);
|
||||||
|
// if mapping element objects, also cache the id string when later
|
||||||
|
// looking up by id alone
|
||||||
|
this.sceneMapById.set(elementKey.id, scene);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user