Skip to content

Commit 3c506cd

Browse files
committed
Make omnibar pinning more consistent
1 parent 100ed79 commit 3c506cd

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/graphics/_misc/helpers.ts

+14
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,17 @@ export function areObjectsEqual(a: object | undefined, b: object | undefined): b
9999

100100
return false;
101101
}
102+
103+
export function areOmnibarObjectsEqual(a: object | undefined, b: object | undefined): boolean {
104+
if (a && b) {
105+
const aMinPinned = JSON.parse(JSON.stringify(a));
106+
const bMinPinned = JSON.parse(JSON.stringify(b));
107+
108+
delete aMinPinned.pin;
109+
delete bMinPinned.pin;
110+
111+
return JSON.stringify(aMinPinned) === JSON.stringify(bMinPinned);
112+
}
113+
114+
return false;
115+
}

src/graphics/omnibar/components/Ticker.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
<script lang="ts">
2626
import { replicantNS } from '@esa-layouts/browser_shared/replicant_store';
27-
import { awaitTimeout, wait, areObjectsEqual } from '@esa-layouts/graphics/_misc/helpers';
27+
import { awaitTimeout, wait, areObjectsEqual, areOmnibarObjectsEqual } from '@esa-layouts/graphics/_misc/helpers';
2828
import { Omnibar } from '@esa-layouts/types/schemas';
2929
import { Vue, Component, Watch } from 'vue-property-decorator';
3030
import GenericMsg from './Ticker/GenericMsg.vue';
@@ -66,7 +66,7 @@ export default class extends Vue {
6666
@Watch('omnibar')
6767
async onOmnibarChange(newVal?: Omnibar, oldVal?: Omnibar): Promise<void> {
6868
// if there was no change, we don't need to hide stuff
69-
if (areObjectsEqual(newVal, oldVal)) {
69+
if (areOmnibarObjectsEqual(newVal, oldVal)) {
7070
return;
7171
}
7272

0 commit comments

Comments
 (0)