This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
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.
Replace filters with an extendibility API to hook into Cart and Checkout blocks #3774
Replace filters with an extendibility API to hook into Cart and Checkout blocks #3774
Changes from all commits
d194c04
a8259ca
8043025
95103f8
91bee6f
e113930
24fceeb
2aeba81
4cfd9b2
e36c22c
1d89ef8
955bf18
957ee96
2add635
9dc1690
73cb8e4
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Logging errors is not very practical, it wouldn't trigger an error on the console (easily missed) and would happen to all users or admins.
I will write a P2 to suggest how we can catch and expose errors, for now, how about you check if the current use is an admin, fi so, you throw, or else you neglect the error and move on.
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.
We will probably need to revisit this after the P2 discussion, but for now I made the change you suggested (throw when the user is an admin) but still kept the
console.error
for costumers: 1712766. Let me know how it looks.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.
This works in this case because we have one filter:
totalLabel
.But if there were more filters the value returned would be of the last filter applied. Is this the expected result, or should the filters have some sort of priority?
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.
Currently, that's an accepted tradeoff, we don't plan on introducing priority for the 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.
Another test we can add (we need to mock
CURRENT_USER_IS_ADMIN
) is passing in invalid code (that throws an exception) and making sure previous filter still passed.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 had a bad time mocking
CURRENT_USER_IS_ADMIN
so it had different values in two different tests. I ended up splitting them in two files: 1d5b636. There might better ways of doing this (let me know if you find how!), but couldn't figure it out how after spending some time on this.