jesus2099 / konami-command

power‐ups for various web sites
122 stars 26 forks source link

No longer shows track inline stuff (ISRC, AcoustID, tools) #682

Closed redactedscribe closed 2 years ago

redactedscribe commented 2 years ago

Note by jesus2099

Duplicate of #596 Workaround is to make this script near or at the end of your userscript list.


The script would previously show AcoustIDs next to each track's name, however this has stopped working. Perhaps the script is broken in other ways, but this is all I've noticed so far.

Thanks.

@version 2021.6.21

jesus2099 commented 2 years ago

It works for me…? Ah, it's in beta.musicbrainz.org, only! right?

So it would be because of one of these current in beta tickets:

jesus2099 commented 2 years ago

Unfortunately, it's not only AcoustID, it's all these things in bold:

So for a beta 10 track release, INLINE STUFF is crashing like this:

react-dom.production.min.js:118 Uncaught Error: Minified React error #425; visit https://reactjs.org/docs/error-decoder.html?invariant=425 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
    at Gr (react-dom.production.min.js:118:466)
    at gs (react-dom.production.min.js:199:369)
    at gu (react-dom.production.min.js:280:85)
    at mu (react-dom.production.min.js:279:450)
    at hu (react-dom.production.min.js:279:320)
    at pu (react-dom.production.min.js:279:180)
    at eu (react-dom.production.min.js:267:209)
    at x (scheduler.production.min.js:13:203)
    at MessagePort.O (scheduler.production.min.js:14:128)

Then 10:

react-dom.production.min.js:147 Uncaught Error: Minified React error #418; visit https://reactjs.org/docs/error-decoder.html?invariant=418 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
    at Lo (react-dom.production.min.js:147:278)
    at vl (react-dom.production.min.js:292:486)
    at mu (react-dom.production.min.js:279:389)
    at hu (react-dom.production.min.js:279:320)
    at pu (react-dom.production.min.js:279:180)
    at eu (react-dom.production.min.js:267:209)
    at x (scheduler.production.min.js:13:203)
    at MessagePort.O (scheduler.production.min.js:14:128)

Then:

react-dom.production.min.js:292 Uncaught Error: Minified React error #423; visit https://reactjs.org/docs/error-decoder.html?invariant=423 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
    at vl (react-dom.production.min.js:292:155)
    at mu (react-dom.production.min.js:279:389)
    at hu (react-dom.production.min.js:279:320)
    at pu (react-dom.production.min.js:279:180)
    at tu (react-dom.production.min.js:270:88)
    at eu (react-dom.production.min.js:267:429)
    at x (scheduler.production.min.js:13:203)
    at MessagePort.O (scheduler.production.min.js:14:128)
jesus2099 commented 2 years ago

Usually, when it's a problem linked to React, like here, I am not at ease to fix it. It will be a fix slowly done with trial and error approach, without ever understanding anything. 🤣

jesus2099 commented 2 years ago

Bad news, the release tracklist DOM is exactly the same in MBS and beta. It really is another React extravaganza.

jesus2099 commented 2 years ago

Strange, I don't see anything related to tracklists in the tickets available for beta testing, specifically in the current 18 tickets copied in my earlier comment, for the record (any later ticket will be even less related).

jesus2099 commented 2 years ago

I see there are debug links in the thrown errors:

Oh noes, not that React hydratation plague, again. 🤯

jesus2099 commented 2 years ago

It looks like React was updated on beta and that, maybe, this new React would completely prevent any userscripts trying to modify a React hydrated area!? If so, we're doomed.

kellnerd commented 2 years ago

There's been a React update recently (which does not have an associated MBS ticket):

jesus2099 commented 2 years ago

The problem may come from:

StrictMode has been enabled on all hydrated elements

It sounds… strict, to me.

jesus2099 commented 2 years ago

Maybe not this problem:

https://reactjs.org/docs/strict-mode.html Note: Strict mode checks are run in development mode only; they do not impact the production build.

I will see when beta tickets are released to MBS…

But they mention checks and warnings, not errors.

jesus2099 commented 2 years ago

Maybe I just need to wait a little bit before adding inline stuff to tracks. It's what did the trick for set recording comments.

redactedscribe commented 2 years ago

It works for me…? Ah, it's in beta.musicbrainz.org, only! right?

I use the beta version of the site primarily, yes. Switching to non-beta "fixes" it. Guess I'll use that until whatever needs to happen, happens.

Thanks for the info @jesus2099!

mwiencek commented 2 years ago

I opened https://github.com/metabrainz/musicbrainz-server/pull/2559 which I hope will help, but it doesn't seem to fix the hydration errors. (I modified the INLINE STUFF script to run on my local dev server to check it against that patch.) It seems the user script is still running before hydration occurs (which happens inside a jQuery ready handler).

mwiencek commented 2 years ago

I checked how INLINE STUFF works in production, and it also runs before hydration occurs. So I think React 18 may have become more strict about when the content changes. But, my patch should allow you to time things more reliably. Can you change the script to run after the document is ready (scheduled after all of MB's "ready" handlers, ideally)? If you need help testing, I can try changes to the script against https://github.com/metabrainz/musicbrainz-server/pull/2559.

jesus2099 commented 2 years ago

Thank you very much for giving some time here, @mwiencek!

Thanks to your explanation, I completely understand what happens and what to do now, it should be easy!

Notice that the set comment script still works, because it is launched later (document-idle instead of document-ready) and then delayed even further by one second..

jesus2099 commented 2 years ago

Sorry to make you lose time, @mwiencek! Don't worry, I will take care of this.

In fact I already had this bug before (unsolved #596), it's just that now, the React hydrate takes longer so it triggers more often (systematically)

I will fix this by finally writing a new version that handles all kinds paginated releases (#38), like recently done for COLLECTION HIGHLIGHTER.

It will solve this issue at the same time!

Thanks again for your bug report, @redactedscribe!

Closing this as duplicate of #596.

jesus2099 commented 2 years ago

I reopen because I had troubles finding this back.

jesus2099 commented 2 years ago

Workaround is to make this script near or at the end of your userscript list.

Thanks for your report! and tell me if the workaround doesn't work for you.

redactedscribe commented 2 years ago

Thanks for your report! and tell me if the workaround doesn't work for you.

Unfortunately it doesn't work. I'm on non-beta, moved INLINE to the bottom of the scripts list, disabled all scripts but INLINE for a particular release page, reloaded (re-cached) the page, still no ISRCs (they're not toggled hidden either).

jesus2099 commented 2 years ago

You need many scripts to run before INLINE for the workaround to work. The aim is to delay the run of INLINE script after many slow scripts. 😉 I did not change anything in my userscript list and it works for me (Android 9, Kiwi Browser, Violentmonkey), it's in the middle of the list.

redactedscribe commented 2 years ago

Even with all my scripts enabled and INLINE and the bottom, I still don't see any AcoustIDs next to the release tracks. I guess I'll just have to wait until you have time and find a fix. Thanks though.

jesus2099 commented 2 years ago

Please tell in #596 if the quick fix worked for you. :)