-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(core): preserve the zoom status only when needed #974
Conversation
src/compiler/spec-preprocess.ts
Outdated
const lockUid = locksByViewUid[viewUid]; | ||
const linkedViewUid = Object.entries(locksByViewUid).find(([_, uid]) => _ && uid === lockUid)?.[0]; | ||
// Only if the linked view existed in the previous spec, we copy the zooming status | ||
const linkedViewExistedPrev = !!prevSpec.views.find(v => v.uid === linkedViewUid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main code I added to fix the issue. This basically checks whether if this view is linked with a view that existed previously.
src/core/gosling-component.tsx
Outdated
@@ -13,6 +13,7 @@ import { isEqual } from 'lodash-es'; | |||
import * as uuid from 'uuid'; | |||
import { publish } from '../api/pubsub'; | |||
import type { IdTable } from '../api/track-and-view-ids'; | |||
import { preverseZoomStatus } from '../compiler/spec-preprocess'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved under \compiler – a better place than this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that this function is only used in gosling-component.tsx
I think it should be kept in /core? I see you logic though, that it is making manipulations on the spec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Would be better to put a file closer to where it is used! Added a util file for this function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tested with the built editor by adding and removing tracks and switching between specs. Looks good to me! Thanks for taking care of this.
src/core/gosling-component.tsx
Outdated
@@ -13,6 +13,7 @@ import { isEqual } from 'lodash-es'; | |||
import * as uuid from 'uuid'; | |||
import { publish } from '../api/pubsub'; | |||
import type { IdTable } from '../api/track-and-view-ids'; | |||
import { preverseZoomStatus } from '../compiler/spec-preprocess'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that this function is only used in gosling-component.tsx
I think it should be kept in /core? I see you logic though, that it is making manipulations on the spec.
Fix #973
Change List
Checklist