mirror of
https://github.com/enso-org/enso.git
synced 2024-12-18 20:21:51 +03:00
Add import field to metadata to satisfy older versions (#11797)
Fixes #11742 I was [wrong](https://github.com/enso-org/enso/issues/11742#issuecomment-2514109015) - not the _new_ fields make metadata broken for older versions, but removing an _old_ field. This PR bring it back, which solves the issue - for a while.
This commit is contained in:
parent
c284bcb854
commit
c410311b15
@ -74,7 +74,11 @@ export function applyDocumentUpdates(
|
||||
if (codeChanged || idsChanged || metadataChanged) {
|
||||
// Update the metadata object.
|
||||
// Depth-first key order keeps diffs small.
|
||||
newMetadata = { node: {}, widget: {} }
|
||||
newMetadata = {
|
||||
node: {},
|
||||
widget: {},
|
||||
import: {}, // "import" is required by older versions (even though they don't use it)
|
||||
}
|
||||
root.visitRecursive(ast => {
|
||||
let pos = ast.nodeMetadata.get('position')
|
||||
const vis = ast.nodeMetadata.get('visualization')
|
||||
|
@ -350,7 +350,7 @@ class ModulePersistence extends ObservableV2<{ removed: () => void }> {
|
||||
// @ts-expect-error This is SAFE. `this.state` is only `readonly` to ensure that
|
||||
// this is the only place where it is mutated.
|
||||
this.state = state
|
||||
if (state === LsSyncState.Synchronized) this.trySyncRemoveUpdates()
|
||||
if (state === LsSyncState.Synchronized) this.trySyncRemoteUpdates()
|
||||
} else {
|
||||
throw new Error('LsSync disposed')
|
||||
}
|
||||
@ -450,10 +450,10 @@ class ModulePersistence extends ObservableV2<{ removed: () => void }> {
|
||||
} else {
|
||||
this.updateToApply = update
|
||||
}
|
||||
this.trySyncRemoveUpdates()
|
||||
this.trySyncRemoteUpdates()
|
||||
}
|
||||
|
||||
trySyncRemoveUpdates() {
|
||||
trySyncRemoteUpdates() {
|
||||
if (this.updateToApply == null) return
|
||||
// apply updates to the ls-representation doc if we are already in sync with the LS.
|
||||
if (!this.inState(LsSyncState.Synchronized)) return
|
||||
|
Loading…
Reference in New Issue
Block a user