-
Notifications
You must be signed in to change notification settings - Fork 153
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
feat: move save button components into query renderers #14533
Conversation
@@ -25,7 +23,7 @@ const FlatGridItem: React.FC<FlatGridItemProps> = ({ artwork, onClick }) => { | |||
const { user } = useSystemContext() | |||
const isTeam = userIsTeam(user) | |||
const { containerProps, isSaveButtonVisible } = useSaveButton({ | |||
isSaved: !!artwork.isSaved, | |||
isSaved: false, |
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 was an issue. isSaved
was being requested outside of the save button context, and right in this component. It was passed to the useSaveButton
hook - which effectively sets isHover: true
- thus letting the old-school deprecated button show up always if you've saved the work (even w/o hovering).
With this change, the 'saved' status doesn't show up unless you hover.
Seems relatively minor to me 🙏
#427 Bundle Size — 9.55MiB (-0.98%).0f8bcc4(current) vs 96291e1 main#425(baseline) Warning Bundle contains 45 duplicate packages – View duplicate packages Bundle metrics
|
Current #427 |
Baseline #425 |
|
---|---|---|
Initial JS | 3.95MiB (-0.68% ) |
3.98MiB |
Initial CSS | 0B |
0B |
Cache Invalidation | 47.47% |
0% |
Chunks | 143 |
143 |
Assets | 146 |
146 |
Modules | 5637 (+0.05% ) |
5634 |
Duplicate Modules | 455 |
455 |
Duplicate Code | 5.88% (+0.34% ) |
5.86% |
Packages | 291 |
291 |
Duplicate Packages | 42 |
42 |
Bundle size by type 2 changes
1 regression
1 improvement
Current #427 |
Baseline #425 |
|
---|---|---|
JS | 9.32MiB (-1.05% ) |
9.42MiB |
Other | 237.84KiB (+1.99% ) |
233.2KiB |
Bundle analysis report Branch saves-list-modal-into-a-renderer Project dashboard
Generated by RelativeCI Documentation Report issue
043560d
to
9d24d12
Compare
@@ -167,7 +167,6 @@ const ViewingRoomWorksRouteFixture: ViewingRoomWorksRoute_Test_Query$rawResponse | |||
date: "2015", | |||
additionalInformation: "some description", | |||
href: "/artwork/bill-miles-beep-beep", | |||
artistNames: "Artist Name", |
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.
not sure why the typescript compiler started having issues with all these fields...
@@ -366,17 +366,17 @@ export const Details: React.FC<DetailsProps> = ({ | |||
|
|||
if (!saveOnlyToDefaultList) { | |||
return ( | |||
<SaveArtworkToListsButtonFragmentContainer | |||
<SaveArtworkToListsButtonQueryRenderer |
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 is the main 'type' of change, continue to prop-drill this analytics prop, but instead of passing in the masked fragment via the artwork
prop, pass in the artwork id to the query renderer.
@@ -605,8 +605,6 @@ export const DetailsFragmentContainer = createFragmentContainer(Details, { | |||
} | |||
...PrimaryLabelLine_artwork | |||
...BidTimerLine_artwork | |||
...SaveButton_artwork |
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 is big - removing these fragments from the standard Artwork
component query (used in rails + grids).
9d24d12
to
a0d0e94
Compare
@@ -95,9 +93,9 @@ const FlatGridItem: React.FC<FlatGridItemProps> = ({ artwork, onClick }) => { | |||
)} | |||
|
|||
{isSaveButtonVisible && ( | |||
<DeprecatedSaveButtonFragmentContainer | |||
<DeprecatedSaveButtonQueryRenderer |
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.
Same thing as above, swapping out fragment container -> query renderer
@@ -133,7 +131,6 @@ export const FlatGridItemFragmentContainer = createFragmentContainer( | |||
@arguments( | |||
includeConsignmentSubmission: $includeConsignmentSubmission | |||
) | |||
...DeprecatedSaveButton_artwork |
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.
Removing the last of these personalized 'save' bits from the overall Artwork
query.
} | ||
`} | ||
placeholder={ | ||
// TODO: This should be a better placeholder, rather than reusing `SaveButtonBase` |
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.
Bit of a hack, trying to reuse the main React component (which is typed with Relay data) as the placeholder
a0d0e94
to
0bc4350
Compare
return ( | ||
<Clickable onClick={() => {}}> | ||
<HeartStrokeIcon fill="white100" width={24} height={24} /> | ||
</Clickable> |
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 makes sense!
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.
👌
11f936f
to
0f8bcc4
Compare
This is a bit naive - literally taking all three save button implementations (which are all live / fragment was being requested in our standard
Artwork
component) - removing their fragments from the parent queries - and replacing theFragmentContainer
invocations withQueryRenderers
. One actual functionality change which I'll comment on inline.Nevertheless... it all continues to work! The correct saved state (as well as lot watched count - collector signal which piggybacks onto this saved artwork component - why isn't it is own component? that could be requested + cached up front) 'pops in' momentarily after the main grid query succeeds + renders - it feels totally fine!
General functionality - the save button works when you toggle it on/off, and the toast which includes the 'List' modal popup - also continues to work.
The only personalized snippets remaining in the main filter/grid query: