mirror of
https://github.com/enso-org/enso.git
synced 2024-12-19 23:21:35 +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) {
|
if (codeChanged || idsChanged || metadataChanged) {
|
||||||
// Update the metadata object.
|
// Update the metadata object.
|
||||||
// Depth-first key order keeps diffs small.
|
// 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 => {
|
root.visitRecursive(ast => {
|
||||||
let pos = ast.nodeMetadata.get('position')
|
let pos = ast.nodeMetadata.get('position')
|
||||||
const vis = ast.nodeMetadata.get('visualization')
|
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
|
// @ts-expect-error This is SAFE. `this.state` is only `readonly` to ensure that
|
||||||
// this is the only place where it is mutated.
|
// this is the only place where it is mutated.
|
||||||
this.state = state
|
this.state = state
|
||||||
if (state === LsSyncState.Synchronized) this.trySyncRemoveUpdates()
|
if (state === LsSyncState.Synchronized) this.trySyncRemoteUpdates()
|
||||||
} else {
|
} else {
|
||||||
throw new Error('LsSync disposed')
|
throw new Error('LsSync disposed')
|
||||||
}
|
}
|
||||||
@ -450,10 +450,10 @@ class ModulePersistence extends ObservableV2<{ removed: () => void }> {
|
|||||||
} else {
|
} else {
|
||||||
this.updateToApply = update
|
this.updateToApply = update
|
||||||
}
|
}
|
||||||
this.trySyncRemoveUpdates()
|
this.trySyncRemoteUpdates()
|
||||||
}
|
}
|
||||||
|
|
||||||
trySyncRemoveUpdates() {
|
trySyncRemoteUpdates() {
|
||||||
if (this.updateToApply == null) return
|
if (this.updateToApply == null) return
|
||||||
// apply updates to the ls-representation doc if we are already in sync with the LS.
|
// apply updates to the ls-representation doc if we are already in sync with the LS.
|
||||||
if (!this.inState(LsSyncState.Synchronized)) return
|
if (!this.inState(LsSyncState.Synchronized)) return
|
||||||
|
Loading…
Reference in New Issue
Block a user