-
Notifications
You must be signed in to change notification settings - Fork 1
MPDX-6917-Remove-Lodash #8
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
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f7588ff
Remove lodash compact, isFunction, isFinite, and isNil
TheNoodleMoose 84be79b
Remove lodash sortBy and find
TheNoodleMoose 6de7698
Remove lodash omit and pick functions, create onative omit function a…
TheNoodleMoose 89abca0
Use object destructuring to omit values, remove omit function, add es…
TheNoodleMoose a3e7545
Remove lodash castArray and remove, switch to native reduce for comme…
TheNoodleMoose 5b7d8af
remove const in favor of just returning object
TheNoodleMoose 8e71fe3
Merge branch 'main' into MPDX-6917-Remove-Lodash and run Prettier on PR
OzzieOrca bf0d738
Remove reduceObject function, remove lodash cloneDeep, switch to loca…
TheNoodleMoose 5ee768c
Remove concat
TheNoodleMoose e4cbdc3
Import specific lodash modules only
OzzieOrca 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 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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,7 @@ import * as yup from 'yup'; | |
| import SendIcon from '@material-ui/icons/Send'; | ||
| import { useMutation, gql } from '@apollo/client'; | ||
| import { motion } from 'framer-motion'; | ||
| import { cloneDeep, reject } from 'lodash/fp'; | ||
| import reject from 'lodash/fp/reject'; | ||
| import { v4 as uuidv4 } from 'uuid'; | ||
| import { CreateTaskCommentMutation } from '../../../../../../types/CreateTaskCommentMutation'; | ||
| import { TaskCommentCreateInput } from '../../../../../../types/globalTypes'; | ||
|
|
@@ -125,16 +125,24 @@ const Form = ({ accountListId, taskId }: Props): ReactElement => { | |
| taskId, | ||
| }, | ||
| }; | ||
| const data = cloneDeep( | ||
| cache.readQuery<GetCommentsForTaskDrawerCommentListQuery>(query), | ||
| const dataFromCache = cache.readQuery<GetCommentsForTaskDrawerCommentListQuery>( | ||
| query, | ||
| ); | ||
| data.task.comments.nodes = [ | ||
| ...reject( | ||
| ({ id: commentId }) => id === commentId, | ||
| data.task.comments.nodes, | ||
| ), | ||
| comment, | ||
| ]; | ||
| const data = { | ||
| task: { | ||
| ...dataFromCache.task, | ||
| comments: { | ||
| ...dataFromCache.task.comments, | ||
| nodes: [ | ||
| ...reject( | ||
| ({ id: commentId }) => id === commentId, | ||
| dataFromCache.task.comments.nodes, | ||
| ), | ||
|
Comment on lines
+137
to
+140
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Still couldn't get the filter method I created to replace this reject to not break the test suite. It works fine in the browser but not in the tests for some reason. |
||
| { ...comment }, | ||
| ], | ||
| }, | ||
| }, | ||
| }; | ||
| cache.writeQuery({ ...query, data }); | ||
| }, | ||
| }); | ||
|
|
||
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
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
Oops, something went wrong.
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.
I know you didn't write any of this but it's some weird code...
The
reduceObjectaround this is the only usage ofreduceObject... And the current implementation throws away all types with the cast toany. Maybe we should just remove it?We could probably use an
Object.entries(filter).reduce((result, [key, value]) => {...}, {}).I'm not sure I understand this default case... I think using the
bracketarrayFormaton theparsehttps://github.com/sindresorhus/query-string#arrayformat might clean up the[]in the key but looks like it although it always returns an array, the types don't know that...