Skip to content

Commit 5ea190e

Browse files
authored
Fix navigation between apps (#5526)
* Fix navigation between apps * Fix bug
1 parent 053e771 commit 5ea190e

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

app/components/windows/Main.vue.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export default class Main extends Vue {
8484

8585
theme: Theme = 'night-theme';
8686
page: TAppPage = 'Studio';
87+
params: Dictionary<string | boolean> = {};
8788
minEditorWidth = 500;
8889

8990
created() {
@@ -102,6 +103,7 @@ export default class Main extends Vue {
102103
});
103104
this.unbindNavigation = this.navigationService.state.bindProps(this, {
104105
page: 'currentPage',
106+
params: 'params',
105107
});
106108

107109
antdThemes[this.theme].use();
@@ -143,10 +145,6 @@ export default class Main extends Vue {
143145
return this.windowsService.state.main.title;
144146
}
145147

146-
get params() {
147-
return this.navigationService.state.params;
148-
}
149-
150148
get applicationLoading() {
151149
return this.appService.state.loading;
152150
}

app/services/realm.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,15 @@ export class RealmObject {
9999
bindProps(target: Object, bindings: Dictionary<string>) {
100100
const setProps = () => {
101101
Object.keys(bindings).forEach(key => {
102-
// TODO: index
103102
// @ts-ignore
104-
target[key] = this[bindings[key]];
103+
// this means the realm object is a complex shape like a dictionary
104+
if (typeof this[bindings[key]] === 'object') {
105+
// @ts-ignore
106+
target[key] = this[bindings[key]].toJSON();
107+
} else {
108+
// @ts-ignore
109+
target[key] = this[bindings[key]];
110+
}
105111
});
106112
};
107113

@@ -188,7 +194,8 @@ export class RealmObject {
188194
// Realm type can be either a string or a nested object with a `type` property or an `objectType`
189195
// property in the case of referential schemas
190196
let type = typeof dataType === 'string' ? dataType : dataType.type;
191-
if (dataType.objectType) type = dataType.objectType;
197+
// dictionaries are not referential schemas although they still have an objectType
198+
if (dataType.objectType && type !== 'dictionary') type = dataType.objectType;
192199
const klass = RealmService.registeredClasses[type];
193200
return klass.fromRealmModel(val);
194201
}

0 commit comments

Comments
 (0)