jesus2099 / konami-command

power‐ups for various web sites
123 stars 27 forks source link

Script removes stuff from merge form? #843

Closed jesus2099 closed 3 months ago

jesus2099 commented 3 months ago

https://community.metabrainz.org/t/bug-when-merging-releases/709026?u=jesus2099

https://github.com/metabrainz/musicbrainz-server/pull/3357/commits/626aadc5534b20d2fabc2b0c90d55de01a97678a

The error described in MBS-13729 was ultimately caused by a userscript removing required fields from the page: in particular, the "merge strategy" selection was being removed, which causes the page to reload with an error ("Merge strategy field is required").

The script also removes all of the fields contained in medium_positions. According to our Flow types, this is unexpected. We expect there to be a corresponding field in medium_positions for each medium.

https://test.musicbrainz.org/release/merge_queue?add-to-merge=873353&add-to-merge=873354

TypeError: Cannot read properties of undefined (reading 'field')
    at /home/musicbrainz/musicbrainz-server/root/static/build/server.js:1:577257
    at Array.map (<anonymous>)
    at /home/musicbrainz/musicbrainz-server/root/static/build/server.js:1:577225
    at Fb (/home/musicbrainz/musicbrainz-server/node_modules/react-dom/cjs/react-dom-server-legacy.node.production.min.js:65:44)
    at Ib (/home/musicbrainz/musicbrainz-server/node_modules/react-dom/cjs/react-dom-server-legacy.node.production.min.js:67:254)
    at W (/home/musicbrainz/musicbrainz-server/node_modules/react-dom/cjs/react-dom-server-legacy.node.production.min.js:73:89)
    at Jb (/home/musicbrainz/musicbrainz-server/node_modules/react-dom/cjs/react-dom-server-legacy.node.production.min.js:76:98)
    at Ib (/home/musicbrainz/musicbrainz-server/node_modules/react-dom/cjs/react-dom-server-legacy.node.production.min.js:68:145)
    at W (/home/musicbrainz/musicbrainz-server/node_modules/react-dom/cjs/react-dom-server-legacy.node.production.min.js:73:89)
    at Jb (/home/musicbrainz/musicbrainz-server/node_modules/react-dom/cjs/react-dom-server-legacy.node.production.min.js:76:98)
jesus2099 commented 3 months ago

Somewhere, I was replacing some MBS text node. And this was curiously recently causing React-hydrate to remove the unrelated merge strategy <select> element.

To avoid that, I now insert stuff, not replace. And now, there is no problems! :)