Page MenuHomePhabricator

After deleting a label in the zobject-editor Label box component, adding a new label overwrites the last one
Closed, ResolvedPublic

Description

Steps to reproduce

"Z12K1": [
    "Z11",
    {
        "Z1K1": "Z11",
        "Z11K1": "Z1002",
        "Z11K2": "Mushroom"
    },
    {
        "Z1K1": "Z11",
        "Z11K1": "Z1003",
        "Z11K2": "Seta"
    },
    {
        "Z1K1": "Z11",
        "Z11K1": "Z1025",
        "Z11K2": "Grzyb"
    }
]
  • Delete any label that's not the last one
  • Updated label JSON is correct:
"Z12K1": [
    "Z11",
    {
        "Z1K1": "Z11",
        "Z11K1": "Z1003",
        "Z11K2": "Seta"
    },
    {
        "Z1K1": "Z11",
        "Z11K1": "Z1025",
        "Z11K2": "Grzyb"
    }
]
  • Add one more label in a non-existing language by typing a new language in the Language selector below

Observed behavior

  • When the new language is selected, this overwrites the last label available in the set.
  • Updated label JSON is wrong:
"Z12K1": [
    "Z11",
    {
        "Z1K1": "Z11",
        "Z11K1": "Z1003",
        "Z11K2": "Seta"
    },
    {
        "Z1K1": "Z11",
        "Z11K1": "Z1314",
        "Z11K2": ""
    }
]

Expected behavior

  • A new label should be added to the existing labels.
  • The correct label JSON should be:
"Z12K1": [
    "Z11",
    {
        "Z1K1": "Z11",
        "Z11K1": "Z1003",
        "Z11K2": "Seta"
    },
    {
        "Z1K1": "Z11",
        "Z11K1": "Z1025",
        "Z11K2": "Grzyb"
    },
    {
        "Z1K1": "Z11",
        "Z11K1": "Z1314",     // with the new selected language, in this case Basque
        "Z11K2": ""
    }
]

Event Timeline

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

[mediawiki/extensions/WikiLambda@master] Function editor: labels behave correctly when deleted.

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

Change 824414 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Function editor: labels behave correctly when deleted.

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

Mahir256 renamed this task from After deleting a label in the zobject-editor Label box component, adding a new label overwrites the last one. to After deleting a label in the zobject-editor Label box component, adding a new label overwrites the last one.Aug 19 2022, 5:11 PM