react-component / react-component/slider
ensureValueNotConflict issue
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 3.1k
- Forks
- 768
- Avg merge
- 11d 22h
- Merged PRs (30d)
- 5
Description
When trying to use this component I noticed that in some situations the bounds wasn't getting properly set in the internal state of the component. I've tracked it down to the trimAlignValue function valNotConflict variable. I'm not sure what this is supposed to be doing but in my situation the correct values are getting passed to the component only to not have the internal bounds set. This causes the startRange to stay at 0 when it should be set to the value passed in [20, 50] with a max of 101 and a min of 0 set.
trimAlignValue(v, handle, nextProps = {}) {
const mergedProps = { ...this.props, ...nextProps };
const valInRange = utils.ensureValueInRange(v, mergedProps);
const valNotConflict = this.ensureValueNotConflict(handle, valInRange, mergedProps);
return utils.ensureValuePrecision(valNotConflict, mergedProps);
}
I think this bit of code has to do with the startRange not being able to move past the endRange if allowCross is set to false but i could be wrong. The ensureValueNotConflict isn't clear to me on what your trying to accomplish and I will more than likely branch off of it to fix locally for my uses but just letting you know I did run into this issue and where the potential code is causing the issue.
Thanks.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating trimAlignValue and ensureValueNotConflict, then reproduce the reported range configuration with value [20, 50], min 0, max 101, and allowCross false. Trace why the internal startRange remains 0 despite the passed bounds. Done means the reported configuration preserves the expected bounds and the behavior is covered by a regression check.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100