mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-18 08:03:11 +00:00
fix(editor): only adopt-and-overwrite a model no editor is showing
Adopting an existing model at the same URI now applies this editor's content, so a model left behind by headless linting is not displayed as if it were the item. Restrict that to unattached models: one another editor is showing may hold edits the user has not saved. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
bfe750b6ea
commit
cf3d487751
@@ -1347,10 +1347,11 @@
|
||||
if (!nmodel) {
|
||||
throw err
|
||||
}
|
||||
// Headless linting creates models at this same canonical URI, so the existing
|
||||
// one can hold whatever content was last linted. Show what this editor was
|
||||
// given, not that.
|
||||
if (nmodel.getValue() !== (code ?? '')) {
|
||||
// Headless linting creates models at this same canonical URI, so an unattached
|
||||
// one holds whatever was last linted rather than this editor's content. Only
|
||||
// adopt-and-overwrite in that case: a model another editor is showing may hold
|
||||
// edits the user has not saved.
|
||||
if (!nmodel.isAttachedToEditor() && nmodel.getValue() !== (code ?? '')) {
|
||||
nmodel.setValue(code ?? '')
|
||||
}
|
||||
model = nmodel
|
||||
|
||||
Reference in New Issue
Block a user