You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched through the existing closed and open issues for eww and made sure this is not a duplicate
I have specifically verified that this bug is not a common user error
I am providing as much relevant information as I am able to in this bug report (Minimal config to reproduce the issue for example, if applicable)
Description of the bug
The safe access operator (?.) fails to recognize an empty string on the left side and return null (as it should according to the documentation), instead throwing an error.
Reproducing the issue
The way I encountered this issue was using a deflisten on playerctl output, which outputs a JSON string but produces an empty string when all players are shut down. Here's a minimal eww.yuck (for Wayland):
When there is an active player, the label correctly contains its state. However, when the player shuts down, playerctl outputs "" and the logs show an error:
error: Failed to turn `` into a value of type json-value
┌─ /home/mex/.config/eww/test-bug/eww.yuck:4:19
│
4 │ (label :text {playerctlstatus?.status}))
│ ───────────────
Expected behaviour
Either
The operator returning a null with an empty string on the left, or
The documentation explicitly stating that the operator only works with a null on the left side and not an empty string.
Additional context
No response
The text was updated successfully, but these errors were encountered:
note that the docs don't lie, they are just misleading.
currently, the empty string is not supported, a string consisting of 2 " (also referred to as an empty json string) is.
this behavior will be removed by #1176, that pr currently makes indexing "" an error, and adds support for the empty string.
Checklist before submitting an issue
Description of the bug
The safe access operator (?.) fails to recognize an empty string on the left side and return null (as it should according to the documentation), instead throwing an error.
Reproducing the issue
The way I encountered this issue was using a
deflisten
onplayerctl
output, which outputs a JSON string but produces an empty string when all players are shut down. Here's a minimaleww.yuck
(for Wayland):When there is an active player, the label correctly contains its state. However, when the player shuts down,
playerctl
outputs "" and the logs show an error:Expected behaviour
Either
null
with an empty string on the left, ornull
on the left side and not an empty string.Additional context
No response
The text was updated successfully, but these errors were encountered: