Page MenuHomePhabricator

"Select function" when function is already selected
Closed, ResolvedPublicBUG REPORT

Assigned To
Authored By
99of9
Sep 11 2023, 1:17 AM
Referenced Files
F42468300: Screenshot from 2024-03-08 16-20-51.png
Mar 8 2024, 3:22 PM
F42468302: Screenshot from 2024-03-08 16-20-45.png
Mar 8 2024, 3:22 PM
F42468292: Screenshot from 2024-03-08 16-20-34.png
Mar 8 2024, 3:22 PM
F42468293: Screenshot from 2024-03-08 16-20-27.png
Mar 8 2024, 3:22 PM
F42041940: image.png
Feb 22 2024, 1:02 PM
F42041793: image.png
Feb 22 2024, 1:02 PM
F42041804: image.png
Feb 22 2024, 1:02 PM
F42039828: Screenshot from 2024-02-22 11-48-53.png
Feb 22 2024, 10:55 AM

Description

Steps to replicate the issue (include links if applicable):

What happens?:

  • "Select Function" shows even though the function is already selected.

What should have happened instead?:

Software version (skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):
Raised on project chat here: https://www.wikifunctions.org/w/index.php?title=Wikifunctions:Project_chat&oldid=52352#Help_please

Event Timeline

A similar thing shows up in the result validation section of this page: https://www.wikifunctions.org/wiki/Z11070?uselang=en&oldid=52133 where it says Enter String even though all fields are filled out once you open the dropdown.

Jdforrester-WMF moved this task from To triage to Backlog on the Abstract Wikipedia team board.

The original bug is calling to a function that doesn't exist (https://www.wikifunctions.org/view/en/Z10601). The function call is also not properly formed: function field contains a function call that supposedly returned a string, instead of containing a function:

Screenshot from 2024-02-22 11-48-53.png (318×426 px, 16 KB)

However, the issue in the comment:

https://www.wikifunctions.org/wiki/Z11070?uselang=en&oldid=52133 where it says Enter String even though all fields are filled out once you open the dropdown.

Is a valid issue and a good point. Whenever we initialize a string object, we set it to empty string, so in this component we decided to interpret an empty string as an unset one and offer the call to action "Enter string" instead.
Because empty strings are perfectly valid, I would suggest removing the "Enter string" call to action to simply put "empty string" or "".

@AAlhazwani-WMF @Jdforrester-WMF any thoughts?

Is a valid issue and a good point. Whenever we initialize a string object, we set it to empty string, so in this component we decided to interpret an empty string as an unset one and offer the call to action "Enter string" instead.
Because empty strings are perfectly valid, I would suggest removing the "Enter string" call to action to simply put "empty string" or "".

@AAlhazwani-WMF @Jdforrester-WMF any thoughts?

for now, i would opt for "". similarly to how we do for key labels, or the evaluator result

image.png (454×364 px, 23 KB)

image.png (922×1 px, 102 KB)

would be interesting to explore visual-only ways to convey the same meaning, but i'll file this in the digital garden for now

image.png (208×840 px, 19 KB)

Is a valid issue and a good point. Whenever we initialize a string object, we set it to empty string, so in this component we decided to interpret an empty string as an unset one and offer the call to action "Enter string" instead.
Because empty strings are perfectly valid, I would suggest removing the "Enter string" call to action to simply put "empty string" or "".

@AAlhazwani-WMF @Jdforrester-WMF any thoughts?

for now, i would opt for "". similarly to how we do for key labels, or the evaluator result

image.png (454×364 px, 23 KB)

image.png (922×1 px, 102 KB)

Agreed.

Hello, the link mentioned a couple times here, shttps://www.wikifunctions.org/view/en/Z10601 just send/redirects me to https://www.wikifunctions.org/wiki/Wikifunctions:Main_Page 🤔?

To clarify following the discussion thread, we want to:

  • show an empty string, "" if none has already been selected (instead of "Select function")
  • but if said function has already been selected, we want to show that (instead of "Select function")

Actually, it would be helpful if someone provided a valid link to smth like https://www.wikifunctions.org/view/en/Z10601 so that I have a clearer idea of what we should see 🙏

Hello, the link mentioned a couple times here, shttps://www.wikifunctions.org/view/en/Z10601 just send/redirects me to https://www.wikifunctions.org/wiki/Wikifunctions:Main_Page 🤔?

Yes, it was deleted back in October.

No, the bug should be rewritten to reflect the comments.

The original bug is calling to a function that doesn't exist (https://www.wikifunctions.org/view/en/Z10601). The function call is also not properly formed: function field contains a function call that supposedly returned a string, instead of containing a function:

Screenshot from 2024-02-22 11-48-53.png (318×426 px, 16 KB)

This is not an issue, so no need to put attention to it.
The following, however, needs to be addressed:

However, the issue in the comment:

https://www.wikifunctions.org/wiki/Z11070?uselang=en&oldid=52133 where it says Enter String even though all fields are filled out once you open the dropdown.

Is a valid issue and a good point. Whenever we initialize a string object, we set it to empty string, so in this component we decided to interpret an empty string as an unset one and offer the call to action "Enter string" instead.
Because empty strings are perfectly valid, I would suggest removing the "Enter string" call to action to simply put "empty string" or "".

We are considering "" as a non-set field, instead of being a valid string (empty, but valid).
This should be addressed, so in the ZObjectToString.vue component, whenever we find an empty string, instead of showing "Enter String", we need to show ""

The problem here has a deeper origin. The getZObjectTerminalValue getter from the zobject store module, returns the following (line 1054):

if ( row.isTerminal() ) {
	return row.value ?
		row.value :
		undefined;
}

Which means that is converting both a ZString empty string and a ZReference empty string into "undefined".
This is okay for ZReference, but for ZString it should return row.value instead, because "" is not undefined but a valid terminal string.

I would do this instead:

if ( terminalKey === Constants.Z_STRING_VALUE ) {
  return row.value;
}
return row.value ? row.value : undefined;

This way, the behavior of terminal empty reference would not be altered (returns undefined if it's not set) but the empty string would not be considered undefined but simply an empty string.

What we want is this:

When an argument is an empty string:

Screenshot from 2024-03-08 16-20-27.png (228×328 px, 6 KB)

Screenshot from 2024-03-08 16-20-34.png (36×124 px, 1 KB)

When an argument is an empty reference:

Screenshot from 2024-03-08 16-20-45.png (223×319 px, 7 KB)

Screenshot from 2024-03-08 16-20-51.png (36×195 px, 3 KB)

Change 1010354 had a related patch set uploaded (by Ecarg; author: Ecarg):

[mediawiki/extensions/WikiLambda@master] Allow empty strings when string value in select function

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

Jdforrester-WMF changed the task status from Open to In Progress.Mar 12 2024, 2:28 PM
Jdforrester-WMF assigned this task to ecarg.
Jdforrester-WMF moved this task from Backlog to In Progress on the Abstract Wikipedia team board.

Change 1010354 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Allow empty strings when string value in select function

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