Repository navigation
Conversation
onQuery fires a new HTTP request on every keystroke, and each async callback published its result unconditionally via launcher.setResults. Requests for successive keystrokes (e.g. for "de gossi" then "de gossip") can resolve out of order over the network, so a stale response could land after a newer one and silently overwrite it with a truncated translation -- e.g. "/tr de gossip" sometimes translating as if only "gossi" had been typed. Track the most recently seen onQuery input in a module-level lastQuery variable (same pattern already used by this repo's bitwarden plugin), and drop any async response whose originating query no longer matches it, instead of publishing it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
onQueryfires a new HTTP request on every keystroke, and each async callback published its result unconditionally vialauncher.setResults. Requests for successive keystrokes (e.g. for"de gossi"then"de gossip") can resolve out of order over the network, so a stale response could land after a newer one and silently overwrite it with a truncated translation — e.g./tr de gossipsometimes translating as if onlygossihad been typed.Motivation
Fixes a user-visible correctness bug: fast typing in the translator launcher command can silently produce a truncated/stale translation with no indication anything went wrong. This patch tracks the most recently seen
onQueryinput in a module-levellastQueryvariable (the same pattern thebitwardenplugin already uses for an analogous staleness problem inlauncher.luau), and drops any async response whose originating query no longer matches it, instead of publishing it.Type of Change
Related Issue
None — found and fixed during local use, no tracking issue filed.
Testing
/tr de gossipand other fast multi-word queries before the fix, reproducing missing-last-word translationsManual Coverage
Not applicable beyond compositor: this is a launcher-command logic fix with no UI/bar/layout surface, so bar position/density, scaling, and multi-monitor coverage don't apply.
Screenshots / Videos
Not applicable — no UI, visual, animation, or layout change.
Checklist
translations/en.json, or this PR adds no new user-facing strings.Additional Notes
None.