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
Suppose we need to programmatically update the color space of <channel-slider> by setting/updating its space attribute.
After we set the space attribute, the corresponding property is updated, and all the dependents should also be updated. One of them is refRange. However, refRange depends not only on the space property but also on the channel. When we try to update refRange, the channel has not been updated yet. This leads to an error when we have an unknown channel in the updated color space, and all other properties that depend on refRange cannot be set.
The channel property, on the other hand, depends only on the space property. So, the channel property should be updated first.
If I get everything correctly, to fix the issue, when we update one of the dependents, we should probably update their dependencies first.
P.S. Changing the props order in the source code doesn't fix the issue.
The text was updated successfully, but these errors were encountered:
We change its color space to p3, e.g., by setting its space attribute programmatically. And we leave the channel property (attribute) untouched. The P3 color space doesn't have the h (the current channel value) coordinate. So, we should probably adjust the channel accordingly by changing its value to the one in the P3 color space. But which coordinate should we choose? Are hue from oklch and, for example, red from P3 related somehow? From my perspective, they are not. If I'm not mistaken, they might also have different ranges of possible values.
If we try to change the channel but not the space, we will face the same issue (but from another perspective).
What if we allow changing space only if it has the specified channel, and the channel might be changed if it's in the specified space? Otherwise, changes to space and channel should be performed simultaneously (though I don't know how it can be performed/implemented).
LeaVerou
changed the title
Issue with the dependency graph when setting an attribute programmatically
[color-picker] Issue with the dependency graph when setting an attribute programmatically
May 7, 2024
Suppose we need to programmatically update the color space of
<channel-slider>
by setting/updating itsspace
attribute.After we set the
space
attribute, the corresponding property is updated, and all the dependents should also be updated. One of them isrefRange
. However,refRange
depends not only on thespace
property but also on thechannel
. When we try to updaterefRange
, thechannel
has not been updated yet. This leads to an error when we have an unknown channel in the updated color space, and all other properties that depend onrefRange
cannot be set.The
channel
property, on the other hand, depends only on thespace
property. So, the channel property should be updated first.If I get everything correctly, to fix the issue, when we update one of the dependents, we should probably update their dependencies first.
P.S. Changing the props order in the source code doesn't fix the issue.
The text was updated successfully, but these errors were encountered: