-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix setting tickwidth, tickcolor, ticklen, linecolor and possibly more attributes via template #4904
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Fix setting tickwidth, tickcolor, ticklen, linecolor and possibly more attributes via template #4904
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
bddaafa
allow template input in Lib.coerce2 - fix issue 4852
archmoj 11fd23c
update axes_breaks-round-weekdaysm baseline
archmoj 756a0ee
refactor coerce rename v to valIn
archmoj a2c1c93
refactor coerce rename out to valOut
archmoj 8d0b4cb
exit early
archmoj 5c3be81
rename propOut to valOut
archmoj 642bf28
add internal _coerce function
archmoj 57cec14
reduce condition checks
archmoj 1d9cc4a
keep track of source and input in _coerce function
archmoj cf7c061
fixup Lib.coerce2 description and color test
archmoj 21b86cd
add jasmine tests to cover invalid inputs in Lib.coerce2
archmoj 2b911d1
make room for opts - rename opts to attr
archmoj adc36cd
validate input when calling from coerce2
archmoj 24d1da9
remove unnecessary validation, also
archmoj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
rename propOut to valOut
- Loading branch information
commit 5c3be81ee1073d199b8399ff02ce8dd7ddf0a3fa
There are no files selected for viewing
8000
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From
coerce
(line 364 above) - then theattr || {}
below would be unnecessary -attr
will always exist.But I'm a little concerned whether the logic below (
theDefault !== undefined && theDefault !== propOut
) is robust - what if your template explicitly provides the same value as the default? IfvalIn
does that, we returnpropOut
, but given the logic here if the template does that we'll returnfalse
.Could we instead make a base function like
_coerce
that returns both the value and where it came from (default, template, or container), then haveexports.coerce
just ignore that second part and return the value, whereasexports.coerce2
returnsfalse
if the value came from a default, otherwise the value?Actually isn't there another already existing problem with
coerce2
? Looks like if you provide an invalidvalIn
, the prop will be set to the default value but it'll look like you set it explicitly. The base function approach would fix that problem too.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexcjohnson thanks for the review.
Please find the commits below.