Skip to content

Commit

Permalink
Fix Layers view not changing on page switch. Closes #5593
Browse files Browse the repository at this point in the history
  • Loading branch information
artf committed Jan 10, 2024
1 parent 9314b57 commit 9a49452
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/navigator/view/ItemView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,8 @@ export default class ItemView extends View {
return this.caret;
}

setRoot(el: Component | string) {
el = isString(el) ? this.em.getWrapper()?.find(el)[0]! : el;
const model = getModel(el);
setRoot(cmp: Component | string) {
const model = isString(cmp) ? this.em.getWrapper()?.find(cmp)[0]! : cmp;
if (!model) return;
this.stopListening();
this.model = model;
Expand Down
2 changes: 1 addition & 1 deletion src/utils/mixins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export const deepMerge = (...args: ObjectAny[]) => {
* @param {HTMLElement|Component} el Component or HTML element
* @return {Component}
*/
const getModel = (el: any, $?: any): Component | undefined => {
const getModel = (el: HTMLElement & { __cashData?: any }, $?: any): Component | undefined => {
let model;
if (!$ && el && el.__cashData) {
model = el.__cashData.model;
Expand Down

0 comments on commit 9a49452

Please sign in to comment.