-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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(ui): add errors and draft state (*) to the code editor #7044
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for vitest-dev ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
[cm, failed], | ||
([cmValue]) => { | ||
const { pause, resume } = watch( | ||
[codemirrorRef, failed, finished, saving] as const, |
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.
add hint here: the watcher receiving saving
with true even when not changed, that's why we use pause and resume it in onSave
.
The problem without pausing this watcher when saving the file => cursor position lost (the caret will go to the first line in the test).
/cc @patak-dev any idea why this behavior?
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 watcher loading the file content being called multiple times when the server re-runs the file, splitting the logic for loading and saving will prevent reloading the content while saving from the view editor.
The cursor will be preserved only when saving the file in the ui view editor, when saving the file in the IDE the cursor position will be lost (will use the line in the url)
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.
Note: we should lock the editor or check if there is something changed when saving, but we cannot set the editor in readonly (maybe refreshing the editor works), rn you can save at any time using the keyboard.
I Will check it again later since latest commit will prevent reloading the race condition in loading watcher.
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.
looks like using setOption('readOnly', true/false)
+ refresh()
we can prevent saving the file while saving it, updated logic and added protection to prevent firing save
event when editor in readOnly mode (also for static html reporter)
Description
We have a regression somewhere, maybe updating Vue dependency, I'm not sure. The problem is that changes included in these 2 PR missing in current version:
This PR adds the draft indicator and the line error to the code editor: tested with test/core and test/browser (only preview).
This PR also includes:
destroy
method is missing in v6wait
when saving the file: Video showing the cursorPlease don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yaml
unless you introduce a new test example.Tests
pnpm test:ci
.Documentation
pnpm run docs
command.Changesets
feat:
,fix:
,perf:
,docs:
, orchore:
.