-
Notifications
You must be signed in to change notification settings - Fork 717
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
objectSpec sub-spec on arrays fix; themeSpec fix #11133
Merged
nucleogenesis
merged 5 commits into
learningequality:release-v0.16.x
from
nucleogenesis:fix--objectspecs-console-errors-begone
Aug 25, 2023
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e051578
objectSpecs handle validating all children of an Array w/ defined spec
nucleogenesis 92d4bff
make themeSpec pass objectSpecs
nucleogenesis 840daae
fix tests in objectSpecs
nucleogenesis 3bbc59e
clarify logic w/ comment
nucleogenesis 684ca27
use isPlainObject instead of isObject <3 @bjester
nucleogenesis 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
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -172,7 +172,7 @@ export default { | |
}, | ||
logos: { | ||
type: Array, | ||
default: [], | ||
default: () => [], | ||
spec: _imageSpec, | ||
}, | ||
}; |
This file contains 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.
There are some unreachable conditions here, considering the first
if
ensuringdata
is only an object or an array. Making this anelse if
would remove!isArray(data)
, but also, wouldisObject
andisArray
ever be true at the same time?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.
It's because
isObject
is super general and comes backtrue
for an Array (and functions) - soisObject && !isArray
needs the!isArray
check there because above that bit I'm checking forisArray
and handling it whentrue
but don't return so the last step is saying "this is an object that isn't an array" -- which probably should also check "is also not a function".Although - now that I look at it again, it'd probably be simpler to just return after succeeding within the block where
isArray
istrue
and passes validation. Will push an updateThere 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.
Since this is just for the object spec, perhaps
isPlainObject
is better? https://lodash.com/docs/4.17.15#isPlainObjectThere 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.
Bah - nevermind I misread the GH diff - it can't return early.
I added a comment to clarify a bit.
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.
Awesome thanks for that - all uses of
isObject
were really trying to askisPlainObject
so I replaced them throughout.