Skip to content

Commit

Permalink
[wikidata] Force react-hydrate value change state change
Browse files Browse the repository at this point in the history
Fixes the small hindrance of visual disappearance of ISNI,
when clicking the new ISNI button
Hindrance described in 582de28

The trick was to let the input event BUBBLING UP!
https://nattaylor.com/blog/2022/userscripts-and-reactjs-forms/
  • Loading branch information
jesus2099 committed Nov 7, 2024
1 parent 27584ac commit c298541
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mb-edit-create_from_wikidata.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// @name MusicBrainz edit: Create entity or fill data from wikipedia / wikidata / VIAF / ISNI
// @namespace mbz-loujine
// @author loujine
// @version 2024.11.7
// @version 2024.11.8
// @downloadURL https://raw.githubusercontent.com/loujine/musicbrainz-scripts/master/mb-edit-create_from_wikidata.user.js
// @updateURL https://raw.githubusercontent.com/loujine/musicbrainz-scripts/master/mb-edit-create_from_wikidata.user.js
// @supportURL https://github.com/loujine/musicbrainz-scripts
Expand Down Expand Up @@ -357,7 +357,8 @@ function fillISNI(isni) {
}
}
if (existing_isni.length === 0) {
isni_fields[0].value = isni;
(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(isni_fields[0]), 'value').set).call(isni_fields[0], isni);
isni_fields[0].dispatchEvent(new Event('input', {bubbles: true}));
$('#newFields').append(
$('<dt>', {'text': 'New ISNI code added:'})
).append(
Expand Down

0 comments on commit c298541

Please sign in to comment.