Page MenuHomePhabricator

Key field "Z3K1/value type" should be initialized as a reference instead of a literal Z4/Type
Closed, ResolvedPublic

Description

Steps to reproduce

Observed behavior

  • There's a dropdown saying "Select a Type", which allows for us to search types and displays possible options.
  • Writing "Str" and select the option "String"
  • While the resulting JSON object is correct ("Z3K1" takes the value "Z6"), the component reflects a strange state:

Screenshot from 2022-08-10 18-07-28.png (160×938 px, 8 KB)

Expected behavior

  • One would expect to see the component in a similar state than when a type is edited (Keep in mind that only custom-built types can have their keys edited, so in order to see this, one has to create a custom type and the view it in the edit page)

Screenshot from 2022-08-10 18-08-00.png (189×1 px, 21 KB)

NOTE (30-08-2022): The related task T316547 addresses the issue when clicking on the field, while this task remains open to fix the initialization of Z3K1/value type as a reference instead of a literal Z4

Event Timeline

Not ready to close.

Steps to reproduce

Observed behavior

  • When creating a key, the initial value of "value type" still is a Z4 literal.
  • When clicking on the "Select a Type" dropdown and writing any character, it automatically changes to reference.

Expected behavior

  • The value starts as a reference:
"Z3K1": " "
  • instead of a literal:
"Z3K1": { 
    "Z1K1": "Z4",
    "Z4K1": "Z0",
    "Z4K2": [
        "Z3"
    ],
    "Z4K3": "Z101"
},

Screenshots

Initial state:

Screenshot from 2022-08-22 18-31-29.png (864×1 px, 124 KB)

After keydown on type selector:

Screenshot from 2022-08-22 18-33-36.png (863×1 px, 124 KB)

I think this behavior has actually been introduced since https://gerrit.wikimedia.org/r/c/mediawiki/extensions/WikiLambda/+/822622, as I'm pretty sure when that was submitted it did not jump straight to the second (reference) state in the UI as soon as you typed a single letter. So it might be worth looking at related patches since then - it is very possible it was one of mine!

Confirming, this does not happen when I pulled down https://gerrit.wikimedia.org/r/c/mediawiki/extensions/WikiLambda/+/822622. Will need further investigation what has changed since.

Change 825791 had a related patch set uploaded (by Dani DW; author: Dani DW):

[mediawiki/extensions/WikiLambda@master] Remove the setting of lookupResults, which was breaking Type selector by updating selected with a null value.

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

gengh renamed this task from Type selector fails when choosing the type of a key during Type creation or edition to Key field "Z3K1/value type" should be initialized as a reference instead of a literal Z4/Type.Aug 30 2022, 6:38 PM
gengh updated the task description. (Show Details)

Change 827988 had a related patch set uploaded (by Dani DW; author: Dani DW):

[mediawiki/extensions/WikiLambda@master] Initialize Z3K1 (Key value type) as a reference rather than a Z4 literal.

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

Change 827988 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Initialize Z3K1 (Key value type) as a reference rather than a Z4 literal.

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