Skip to content
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

Mentions autocomplete sometimes adds an additional letter at the end #26

Open
davidfurlong opened this issue Oct 21, 2023 · 11 comments
Open
Labels
bug Something isn't working

Comments

@davidfurlong
Copy link
Contributor

davidfurlong commented Oct 21, 2023

Repro steps:
type "@d" select "@df". It inserts "@df f" instead of just "@df". This happens with other names too

@davidfurlong davidfurlong added the bug Something isn't working label Oct 21, 2023
@stephancill
Copy link
Contributor

Can't seem to reproduce. What browser are you using?

@davidfurlong
Copy link
Contributor Author

arc

@davidfurlong
Copy link
Contributor Author

weird I can't repro every time, but I can still repro. Repro'd in safari as well - probs not a browser thing

@stephancill
Copy link
Contributor

stephancill commented Oct 23, 2023

Consistent way of reproducing is to type @d - wait for the request to complete, then type f and click the result immediately

May require a patch to change the way that tiptap behaves. The range of text that is replaced is calculated and passed here https://github.com/ueberdosis/tiptap/blob/main/packages/suggestion/src/suggestion.ts#L102

@stephancill
Copy link
Contributor

Reporting on my findings after doing some more digging. I think it would be useful to find where the suggestions plugin's state is updated and if that is somehow accessible from the mentions extension configuration. If we can trigger a state update on key press or when the mentioned user is selected it should solve our problem.

@davidfurlong
Copy link
Contributor Author

wonder if we can repro on https://tiptap.dev/api/nodes/mention and if not (as I suspect), what the difference in the code is

@stephancill
Copy link
Contributor

stephancill commented Oct 24, 2023 via email

@davidfurlong
Copy link
Contributor Author

Struggling to reproduce this reliably. I think we can remove this as a requirement for releasing. I suspect it's this here: ueberdosis/tiptap#2544

@davidfurlong
Copy link
Contributor Author

there's a workaround here: ueberdosis/tiptap#2592

@stephancill
Copy link
Contributor

I don't think that this is related tbh.

You type @A, and the Suggestion utility will call onKeyDown, which in turn calls reactRenderer.ref?.onKeyDown(props), which crashes the application:

Our problem is with the Suggestion state not being updated in time. Renderer is working fine

Repro: https://www.loom.com/share/7ab5d51dcb3347e6ad9d12e8541fd6fc?sid=b79b84d8-ffd6-4a58-a422-62b49d426e7f

@davidfurlong
Copy link
Contributor Author

ok yeah you're probably right

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants