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

Cannot read property 'innerText' of null at Y (App.svelte:359) #53

Closed
NawaNae opened this issue Apr 7, 2022 · 6 comments · Fixed by #56
Closed

Cannot read property 'innerText' of null at Y (App.svelte:359) #53

NawaNae opened this issue Apr 7, 2022 · 6 comments · Fixed by #56

Comments

@NawaNae
Copy link

NawaNae commented Apr 7, 2022

at App.svelte:359

document.querySelector('[class^=textArea-] span').innerText; 

the return value of querySelector is null

my discordCanary dom of textArea does not contain any span
like

<textarea ... class="textArea-2CLwUE fontSize16Padding-XoMpjI scrollbarGhostHairline-2LpzZ9 scrollbar-3vVt8d"></textarea>

so I am not sure if just change this line into

document.querySelector('[class^=textArea-]').innerText; 

can solve this problem or not

(I don't know how to debug this plugin sorry)

Thanks a lot

@BobbyWibowo
Copy link
Contributor

BobbyWibowo commented Apr 13, 2022

Are you still encountering this issue? We have been unable to replicate this till date, even in Canary


so I am not sure if just change this line into:

document.querySelector('[class^=textArea-]').innerText; 

It should indeed suppress the error, and may even still work as expected, however I can't entirely be sure until encountering it on my end too

@NawaNae
Copy link
Author

NawaNae commented Apr 14, 2022

I still encountered this issue in my canary, and I find the difference between Canary, PTB and Discord.

Env

Canary 124017 (2c2001f)
BetterDiscord 1.5.3

The message sending box (textarea) are using different element to implement
image

Canary
image

PTB & Discord
image

So, canary only uses placeholder attr of textarea to show the message in message sending box (PTB and discord use div and span to show)
image

Experiment

I tried to insert a fake span in textarea using

var fakeSpan = document.createElement("span")
fakeSpan.style.display="none"
document.querySelector('[class^=textArea-]').appendChild(fakeSpan)

can solve this problem temporarily

Conclusion

I am not pretty sure whether only I meet this in Canary as @BobbyWibowo said "unable to replicate this till now, in Canary"
Although I disabled all of my plugins and themes in Canary, the Dom is still like the screenshot shown above. Hence, I think maybe the original Dom in Canary 124017 may like above.


Sorry, I miss the message that you also encountered this
"encountering it on my end too"
Therefore, it might caused by new version of canary.

Maybe there is any better discord api can tell which discord client are using, and try to fix this issue by the stuff just like if "canary" else ... ?

@BobbyWibowo
Copy link
Contributor

Canary 124017 (2c2001f)

In which OS did you get this Canary build?
It might have been a temporary update to use <textarea/>

On my Windows boot, my Canary build is at Canary 124157 (ad7bbc4), and it's using <div></span></div>, just like in Discord Stable

image


Sorry, I miss the message that you also encountered this
"encountering it on my end too"
Therefore, it might caused by new version of canary.

Ah, I might have worded it wrong
I meant that I still had not encountered the issue, even in Canary, so I could not be sure if the workaround would work fine

@NawaNae
Copy link
Author

NawaNae commented Apr 15, 2022

Canary 124017 (2c2001f)

In which OS did you get this Canary build? It might have been a temporary update to use <textarea/>

Windows 11 Home 21H2 22000.613
image

Because my Canary version num (124017) seems to be lower than yours (124157).
I just tried to reinstall Canary, and the version num became Canary 124163 (9d74307) which is bigger than 124157 as well as 124017.
Still I get textarea in message sending box
image

@BobbyWibowo
Copy link
Contributor

I figured it out

Discord uses <textarea/> when this option below is turned off
image

I will make a pull request containing a fix soon

@NawaNae
Copy link
Author

NawaNae commented Apr 15, 2022

Thanks a lot. Then I just trun this switch on for a temporary solution.

@Pitu Pitu closed this as completed in #56 Apr 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants