Page MenuHomePhabricator

Snak hashes for qualifiers and references missing in entity HTML after statement save
Closed, ResolvedPublic

Description

After saving a new statement, qualifiers and references don’t have the wikibase-snakview-abcd1234… class with the hash. I suspect this might be because they’re in a generic wikibase-listview, which might not propagate the full change.

This is necessary to get constraint check results on qualifiers and references (T168532) after saving a statement, but not a blocker for that issue.

Patch-For-Review:

Event Timeline

Lucas_Werkmeister_WMDE renamed this task from Snak hashes missing in entity HTML after statement save to Snak hashes for qualifiers and references missing in entity HTML after statement save.Sep 25 2017, 1:51 PM
Lucas_Werkmeister_WMDE updated the task description. (Show Details)

I think there might be some type confusion. When updating the value, statementview propagates the claim’s qualifiers to the qualifier listview:

this._qualifiers.option( key, value.getClaim().getQualifiers() );

value.getClaim().getQualifiers() is a wikibase.datamodel.SnakList, which has a length and an array of _items, but is not itself an array. But listview seems to expect an array directly, or at least something subscriptable:

for ( var i = 0; i < value.length; i++ ) {
    this._addLiValue( value[ i ] );
}

With the SnakList in value, value[ i ] is undefined.

Ah, that bit in statementview is my own hacked-together code, so it’s pretty likely wrong :) no need to assume that the author knew what they were doing in that case.

Change 380753 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/Wikibase@master] Fix statementview change propagation

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

Change 380754 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/Wikibase@master] Update hash when initializing snakview

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

Change 380753 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Fix statementview change propagation

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

Change 380754 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Update hash when initializing snakview

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

Lucas_Werkmeister_WMDE claimed this task.

Fixed, and with the pending changes in T168532 merged constraint checks on qualifiers and references now also work after saving :)