Skip to content

fix: fixes issue where the autocomplete tui dialog flickers while typing#11641

Merged
rekram1-node merged 2 commits intoanomalyco:devfrom
jcampuza:fix/autocomplete-flicker-for-@-and-slash-commands
Feb 2, 2026
Merged

fix: fixes issue where the autocomplete tui dialog flickers while typing#11641
rekram1-node merged 2 commits intoanomalyco:devfrom
jcampuza:fix/autocomplete-flicker-for-@-and-slash-commands

Conversation

@jcampuza
Copy link
Contributor

@jcampuza jcampuza commented Feb 1, 2026

Fixes #11640

What does this PR do?

I noticed that when typing @ and / commands in the opencode TUI that you would see the dialog flickering as you type. This is especially true when you type pretty fast here. (For example while typing you'd see the Opencode logo flicker behind as the dialog opens and closes rapidly

This PR fixes that issue by making sure to only update the search value after the value of the filter has settled (i.e. has been flushed due to how Solid works). The issue was caused because the filter depends on both the value (reactive) and non-reactive values that need to be flushed (the input ref/cursor)

Here is the "before" state with the flickering: NOTE that due to framerate you might not see it as well as you would locally well here.

Screen.Recording.2026-02-01.at.11.12.56.AM.mov

Another better example:

Screen.Recording.2026-02-01.at.11.18.46.AM.mov

How did you verify your code works?

I tested manually. GIFS below of after state

Screen.Recording.2026-02-01.at.11.16.00.AM.mov

Another example with it fixed and simpler inputs

Screen.Recording.2026-02-01.at.11.20.35.AM.mov

Note: PR updated with better assets, but still framerate may make it difficult to see at times.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 1, 2026

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

opencode-agent bot added a commit that referenced this pull request Feb 1, 2026
opencode-agent bot added a commit that referenced this pull request Feb 1, 2026
opencode-agent bot added a commit that referenced this pull request Feb 1, 2026
opencode-agent bot added a commit that referenced this pull request Feb 1, 2026
opencode-agent bot added a commit that referenced this pull request Feb 1, 2026
opencode-agent bot added a commit that referenced this pull request Feb 1, 2026
opencode-agent bot added a commit that referenced this pull request Feb 2, 2026
@rekram1-node
Copy link
Collaborator

/review

setSearch("")
return
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: The two if statements on lines 136-143 can be combined since they both do the same thing (setSearch("") and return). Since undefined and "" are both falsy, you could simplify to:

Suggested change
createEffect(() => {
const next = filter()
if (!next) {
setSearch("")
return
}
setSearch(next)
})

This is just a suggestion for cleaner code - the current implementation is functionally correct.


// filter() reads reactive props.value plus non-reactive cursor/text state.
// On keypress those can be briefly out of sync, so filter() may return an empty/partial string.
// Copy it into search in an effect because effects run after reactive updates have/render and paint have
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor typo in comment: "have/render" appears to be a copy-paste artifact. Consider fixing to make the comment clearer (e.g., "...after reactive updates, render, and paint have been applied...").

@jcampuza
Copy link
Contributor Author

jcampuza commented Feb 2, 2026

@rekram1-node addressed the pr feedback if you get another chance at some point. Thanks!

@rekram1-node rekram1-node merged commit f9aa209 into anomalyco:dev Feb 2, 2026
2 of 4 checks passed
ishaksebsib pushed a commit to ishaksebsib/opencode that referenced this pull request Feb 4, 2026
ishaksebsib pushed a commit to ishaksebsib/opencode that referenced this pull request Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Opencode autocomplete dialog options flicker while typing @ and / commands

2 participants