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

1.48.0 crashes sometimes when i try to quote-reply #4337

Open
hpk42 opened this issue Nov 12, 2024 · 5 comments
Open

1.48.0 crashes sometimes when i try to quote-reply #4337

hpk42 opened this issue Nov 12, 2024 · 5 comments
Labels
bug Something isn't working
Milestone

Comments

@hpk42
Copy link
Contributor

hpk42 commented Nov 12, 2024

image

@hpk42 hpk42 added the bug Something isn't working label Nov 12, 2024
@WofWca
Copy link
Collaborator

WofWca commented Nov 13, 2024

Is it 100% reproducible for you? I can't reproduce.

@hpk42
Copy link
Contributor Author

hpk42 commented Nov 13, 2024 via email

@WofWca WofWca self-assigned this Nov 13, 2024
@WofWca
Copy link
Collaborator

WofWca commented Nov 13, 2024

I looked through all the .slice we have in the codebase and narrowed it down to these two lines:

quote.text.slice(0, 3000 /* limit quoted message size */) || ''

They produce the same stack trace as in the screenshot you posted, unlike other .slice. I might have missed some, but the first line I mentioned looks like the likely candidate. Edit: or IDK, I do not see how quote can have an undefined text: it's provided by the core, and it should always be a string.

@WofWca WofWca assigned WofWca and unassigned WofWca Nov 13, 2024
@WofWca
Copy link
Collaborator

WofWca commented Nov 13, 2024

@Simon-Laux also encountered this issue:

must be in react render function and inside of the message list+composer component, because that error boundary was triggered. I also can not reproduce it with the echo bot. basically I was quickly switching between quote messages while your answers came in.

And I myself also just managed to reproduce this with [email protected]. I sent a message to it and starting quickly pressing Ctrl+Up to quote, and got the crash: Cannot read properties of undefined (reading 'slice').

And indeed it points to this line, Message.tsx:805:28):

quote.text.slice(0, 3000 /* limit quoted message size */) || ''

However, I am not 100% sure that this is the very same issue as in the original post.

@WofWca
Copy link
Collaborator

WofWca commented Nov 13, 2024

This is what I got by putting a conditional breakpoint quote.text == undefined there.

image

Looks like these two pieces of code could be causing the crash:

draftRef.current.quote = {
kind: 'WithMessage',
messageId,
} as Type.MessageQuote

draftRef.current.quote = {
kind: 'WithMessage',
messageId,
} as Partial<Type.MessageQuote> as any as Type.MessageQuote

They actually mutate the state, draftState, bypassing _setDraft, and make the state invalid (because .quote is missing the required properties). draftRef was introduced in 4bbdbe3.

I think this issue should belong to the "New Composer" project, given that it is not super severe. Un-assign it from the project if you disagree.

@WofWca WofWca added this to the New composer milestone Nov 13, 2024
@WofWca WofWca removed their assignment Nov 13, 2024
@WofWca WofWca changed the title 1.48.0 crashes when i try to quote-reply to an webxdc-app message 1.48.0 crashes sometimes when i try to quote-reply Nov 14, 2024
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