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 think this is a bug and that status should be reimplemented as a getter so it's not possible to set state from outside.
It is potentially a breaking change - users might have already started exploiting that behaviour in case there's neither onError nor one uses taskComplete rejections
Demo shows that it's possible to make task render with error renderer 2 ways
one way that's arguably "correct", one that will make onError run and will make taskComplete promise get rejected,
one way that's IMO wrong and shouldn't be allowed, one which doesn't make onError or taskComplete promise rejected
Workaround
To prepare a task in such way that there's a way to fail it if it's needed (repro has such way)
Is this a regression?
No or unsure. This never worked, or I haven't tried before.
Affected versions
all
Browser/OS/Node environment
all
The text was updated successfully, but these errors were encountered:
jrencz
changed the title
It shouldn't be possible to assign status from outside
[task] It shouldn't be possible to assign status from outside
Feb 13, 2024
That makes sense to me. It would be weird for a user to set the task status themselves. I can't think of a valid reason for that to happen. So making it a getter instead sounds reasonable.
jrencz
added a commit
to jrencz/lit
that referenced
this issue
Feb 15, 2024
Which package(s) are affected?
Task (@lit/task)
Description
I noticed that it's possible to set the status of a task manually, from outside, not via args, but just by assigning a value to
task.status
.As long as the value is valid
TaskStatus
(let's say:TaskStatus.ERROR
), it will result in rendering using expected renderer, butthis.requestUpdate()
is called as well:onError
of the task won't runtaskComplete
promise won't be rejectedI think this is a bug and that
status
should be reimplemented as a getter so it's not possible to set state from outside.It is potentially a breaking change - users might have already started exploiting that behaviour in case there's neither
onError
nor one usestaskComplete
rejectionsReproduction
repro
Demo shows that it's possible to make task render with
error
renderer 2 waysonError
run and will maketaskComplete
promise get rejected,onError
ortaskComplete
promise rejectedWorkaround
To prepare a task in such way that there's a way to fail it if it's needed (repro has such way)
Is this a regression?
No or unsure. This never worked, or I haven't tried before.
Affected versions
all
Browser/OS/Node environment
all
The text was updated successfully, but these errors were encountered: