-
-
Notifications
You must be signed in to change notification settings - Fork 274
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
DiffEditor fix: set correct model before value update #479
DiffEditor fix: set correct model before value update #479
Conversation
@StefanDBTLabs thanks for opening PR 🙌 I'll keep you up to date once I check it. |
hey @StefanDBTLabs 👋 I checked your report and I can confirm that there is an issue. At the same time, the issue isn't related to Revert your changes and add these two // ...
useUpdate(
() => {
if (editorRef.current && monacoRef.current) {
const originalEditor = editorRef.current.getOriginalEditor();
const model = getOrCreateModel(
monacoRef.current,
original || '',
originalLanguage || language || 'text',
originalModelPath || '',
);
if (model !== originalEditor.getModel()) {
originalEditor.setModel(model);
}
}
},
[originalModelPath],
isEditorReady,
);
useUpdate(
() => {
if (editorRef.current && monacoRef.current) {
const modifiedEditor = editorRef.current.getModifiedEditor();
const model = getOrCreateModel(
monacoRef.current,
modified || '',
modifiedLanguage || language || 'text',
modifiedModelPath || '',
);
if (model !== modifiedEditor.getModel()) {
modifiedEditor.setModel(model);
}
}
},
[modifiedModelPath],
isEditorReady,
);
function disposeEditor(...) Let me know if this makes sense and thanks a lot for your effort 🙂 |
thanks for helping to debug this issue. |
merged 🥳 I'll let you know once I publish a new version |
Is there any estimate on when the new version will be published? |
@StefanDBTLabs @CaptainArni it's published 🎉 check |
When trying to keep the models in the
DiffEditor
the code sometimes updated the incorrect model with the incorrect value because it assumes the correct model is loaded. This update checks and sets the correct model for the passed modelpath before allowing updates to be made.This addresses the issue described in #478