Page MenuHomePhabricator

jQuery.entityselector widget returns wrong selected entity information (label set to ID if no label)
Closed, ResolvedPublic

Description

The Object representing the selected entity selected within a jQuery.entityselector contains wrong information. The label field of the object contains the entity's ID in case there is no label defined. This is simply wrong and falsifies the entity cache on the JS-client side which we update with the entityselector's information. This will result in PVSnaks using items not being displayed pretty/consistent in case the selected item has no label.


Version: unspecified
Severity: normal

Details

Reference
bz43317

Event Timeline

bzimport raised the priority of this task from to Needs Triage.
bzimport set Reference to bz43317.
bzimport added a subscriber: Unknown Object (MLST).
Danwe created this task.Dec 21 2012, 1:28 PM
Danwe added a comment.Dec 21 2012, 1:30 PM

The root of the problem must be in jquery.ui.entityselector.js, '_success' function, line 240 with "response.search[i].value = response.search[i].id"

This is very weird because the .value was just for entityselector internals as far as I can remember. i can't see the .label being touched anywhere. Perhaps its a jQuery.suggester thing.

Although one might have a different view point towards what is described as "simply wrong", https://gerrit.wikimedia.org/r/#/c/39853/ should fix the problem.

Danwe added a comment.Dec 25 2012, 3:28 AM

Thanks, I will test this soon!

Don't think one could argue against "Simply Wrong" about this being a bug currently. At least not without being wrong OR changing existing documentation which would then require non-trivial changes downstream (wb.entities etc.).
After all, an Object representing an entity in JS shouldn't be smart or give you different information than the one on the server, UNLESS the documentation will explain and warn you about it. And yes, then you can argue about it all night long by having different point of views.

Verified in Wikidata demo sprint 28

Restricted Application added a project: Wikidata. · View Herald TranscriptJan 28 2016, 6:08 PM
Restricted Application added a subscriber: StudiesWorld. · View Herald Transcript