From c2985419a15d1041bced5452803f8b4c63d3f8d1 Mon Sep 17 00:00:00 2001 From: jesus2099 Date: Fri, 8 Nov 2024 00:27:14 +0100 Subject: [PATCH] [wikidata] Force react-hydrate value change state change Fixes the small hindrance of visual disappearance of ISNI, when clicking the new ISNI button Hindrance described in 582de280ee6913a1527512a02462fadafba65333 The trick was to let the input event BUBBLING UP! https://nattaylor.com/blog/2022/userscripts-and-reactjs-forms/ --- mb-edit-create_from_wikidata.user.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mb-edit-create_from_wikidata.user.js b/mb-edit-create_from_wikidata.user.js index 7ac1c8b..c996ee7 100644 --- a/mb-edit-create_from_wikidata.user.js +++ b/mb-edit-create_from_wikidata.user.js @@ -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 @@ -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( $('
', {'text': 'New ISNI code added:'}) ).append(