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
Symptom:
When using lockToContainerEdges on the SlickList (or ContainerMixin), the library throws an error: Error: lockOffset value should be a finite. Given NaN
This happens without setting lockOffset or when setting it to a single pixel or percent value.
Cause:
The getLockPixelOffset function receives a NaN due to a bug in the getLockPixelOffsets function.
Any string for lockOffset is always forcedly converted to a number (using the unary + operator):
If the string is not a pure number, it is converted to NaN. The result is passed on to the getLockPixelOffset function, which in turn has actual code to handle strings with a px or % suffix. Accordingly, as the default value used for lockOffset is "50%", this also converts to NaN and causes the error.
Suggested fix:
Remove the invalid and redundant string-to-number conversion shown above and also correct the associated type annotations. I will add a PR addressing this.
Workaround for now:
Explicitly set lockOffset to an array of strings when using lockToContainerEdges.
For example, to get the expected behavior of the default value of 50% for lockOffset, explitcitly set it to `['50%', '50%'], e.g.:
Symptom:
When using
lockToContainerEdges
on theSlickList
(orContainerMixin
), the library throws an error:Error: lockOffset value should be a finite. Given NaN
This happens without setting
lockOffset
or when setting it to a single pixel or percent value.Cause:
The
getLockPixelOffset
function receives aNaN
due to a bug in thegetLockPixelOffsets
function.Any string for
lockOffset
is always forcedly converted to a number (using the unary + operator):If the string is not a pure number, it is converted to
NaN
. The result is passed on to thegetLockPixelOffset
function, which in turn has actual code to handle strings with apx
or%
suffix. Accordingly, as the default value used forlockOffset
is"50%"
, this also converts toNaN
and causes the error.Suggested fix:
Remove the invalid and redundant string-to-number conversion shown above and also correct the associated type annotations. I will add a PR addressing this.
Workaround for now:
Explicitly set
lockOffset
to an array of strings when usinglockToContainerEdges
.For example, to get the expected behavior of the default value of
50%
forlockOffset
, explitcitly set it to `['50%', '50%'], e.g.:The text was updated successfully, but these errors were encountered: