Page MenuHomePhabricator

[MEX] M3.1.2 refactor and tidy up use of state in edit statement forms
Closed, ResolvedPublic

Description

The current implementation of the MEX / wbui2025 user interface has relatively complicated state management for changes-in-progress that is mutated within various different components in an unintuitive way. @Lucas_Werkmeister_WMDE suggests that:

  • there’s too much happening in the components, it should move into the store
  • there should be a separate store (in the same Pinia instance) from the statementsStore; data should only move back into the statementsStore when the edit has been saved
  • (these two, together, should hopefully get rid of a lot of the current Object.assign( {}, … ) and JSON.parse( JSON.stringify( … ) ) stuff that’s keeping the in-progress edits out of the statementsStore at the moment)

Additionally:

  • the “statement being edited” store should primarily contain the values in a form that can be directly bound to the text inputs, i.e. not yet in parsed data value form
  • separately, there should be a store (cache?) of parsed data values (property ID → string input → Promise for parsed response); when the user types into the input, we send out the wbparsevalue request and put it in this store
  • the publish button should be enabled if the parsed data value store contains resolved responses for all the currently used text inputs (and at that point we can then also check if it’s actually different from the currently saved value in the statementsStore, and disable the button if the user’s input results in no change to the saved value, e.g. only adding surrounding whitespace)
  • publishing the edit pulls the corresponding parsed data values out of that cache (for the main value, qualifiers, and references) and then assembles the entity in the format we send to wbeditentity

Acceptance Criteria

  • wbui2025 code should be refactored to use a second pinia store for work-in-progress edits
  • the refactor should incorporate the above feedback / observations

The Acceptance Criteria regarding wbparsevalue and the publish button have been moved to T405238

Event Timeline

Change #1192858 had a related patch set uploaded (by Arthur taylor; author: Arthur taylor):

[mediawiki/extensions/Wikibase@master] [WIP] Refactor the statement store to add editStatementStore

https://gerrit.wikimedia.org/r/1192858

Change #1193047 had a related patch set uploaded (by Arthur taylor; author: Arthur taylor):

[mediawiki/extensions/Wikibase@master] Refactor: rename statementsStore to savedStatementsStore

https://gerrit.wikimedia.org/r/1193047

Change #1193116 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@master] Clean up stores

https://gerrit.wikimedia.org/r/1193116

Change #1192858 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Refactor the statement store to add editStatementStore

https://gerrit.wikimedia.org/r/1192858

Change #1193047 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Refactor: rename statementsStore to savedStatementsStore

https://gerrit.wikimedia.org/r/1193047

Change #1193116 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Clean up stores

https://gerrit.wikimedia.org/r/1193116