post_status_form: enable sync flush for watcher #414

Open
novenary wants to merge 1 commit from novenary/akkoma-fe:sticky-drafts into develop
First-time contributor

This fixes drafts not clearing after posting a reply.

Vue 3.3.11 changed watchers to stop firing after component unmount.
After posting a reply, the post form is removed, now causing the queued event to be discarded.
Synchronous flush causes the handler to be called immediately when changes happen, solving the problem.

See: https://github.com/vuejs/core/pull/7181
See: 80e2128d52
Fixes: a7dea2f70f
Fixes: #413

This fixes drafts not clearing after posting a reply. Vue 3.3.11 changed watchers to stop firing after component unmount. After posting a reply, the post form is removed, now causing the queued event to be discarded. Synchronous flush causes the handler to be called immediately when changes happen, solving the problem. See: https://github.com/vuejs/core/pull/7181 See: https://github.com/vuejs/docs/commit/80e2128d52603856a26a8bb7258606cfe80561e9 Fixes: a7dea2f70f2beba781068a7ff7d8a2a9ef8a9478 Fixes: #413
Member

Can confirm the issue and that this fix works.

Vue doc’s warning about perf implications warrants some attention though. Iirc you already tested individual keystrokes never got batched to begin with off-site, but how does flush: "sync" affect performance of pasted text compared to before the dep upgrade? Is there still only one update for the watcher to process, did it already trigger one update per character before, or does the event count explode with this? If all is fine, ideally document the findings in the commit message

Can confirm the issue and that this fix works. Vue doc’s warning about perf implications warrants some attention though. Iirc you already tested individual keystrokes never got batched to begin with off-site, but how does `flush: "sync"` affect performance of pasted text compared to before the dep upgrade? Is there still only one update for the watcher to process, did it already trigger one update per character before, or does the event count explode with this? If all is fine, ideally document the findings in the commit message
Author
First-time contributor

As far as I can tell, pasting is atomic (produces a single event) which makes intuitive sense to me.

As far as I can tell, pasting is atomic (produces a single event) which makes intuitive sense to me.
novenary force-pushed sticky-drafts from 13383982bc to ef242a1ddd 2024-10-14 21:18:38 +00:00 Compare
Author
First-time contributor

Updated the commit message accordingly. I think it wouldn't be a bad idea to add debouncing.

Updated the commit message accordingly. I think it wouldn't be a bad idea to add debouncing.
Oneric approved these changes 2024-10-14 21:42:01 +00:00
Oneric left a comment
Member

seems all good then; thanks for tracking this down!

seems all good then; thanks for tracking this down!
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u sticky-drafts:novenary-sticky-drafts
git checkout novenary-sticky-drafts
Sign in to join this conversation.
No description provided.