-
Notifications
You must be signed in to change notification settings - Fork 572
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: add home view section screen #10546
Conversation
src/app/routes.ts
Outdated
@@ -192,6 +192,7 @@ function getDomainMap(): Record<string, RouteMatcher[] | null> { | |||
addRoute("/galleries-for-you", "GalleriesForYou"), | |||
addRoute("/gene/:geneID", "Gene"), | |||
addRoute("/home-view", "HomeView"), | |||
addRoute("/home-view/section/:sectionId", "HomeSectionScreen"), |
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.
glad to hear thoughts about the naming here
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.
suggestion: sectionId
> sectionID
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.
nice idea
artworksQuery, | ||
{ id: props.sectionId }, | ||
{ | ||
// This is necessary to avoid displaying cached because this component is used in more than one place and Relay returns data from another screen before the new data is loaded. |
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.
Shouldn't this return cached data per sectionID? 🤔
|
||
// This won't happen because the query would fail thanks to the @principalField | ||
// Adding it here to make TS happy | ||
if (!data.homeView.section || !data.homeView.section.component?.title) { |
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.
If we require the title here, should we make it nonNullable in the schema instead?
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 believe title
was already non-nullable but this PR should alleviate the other null checking here.
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.
Looking good! 🔥
// This is necessary to avoid displaying cached because this component is used in more than one place and Relay returns data from another screen before the new data is loaded. | ||
fetchPolicy: "network-only", | ||
} | ||
) |
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.
question: Curious is there's a way to prevent relay cache data from leaking into the wrong components. I would think that maybe the arguments, like ID, would determine if a cached result is eligible or not.
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.
Agree- maybe this is something to look into- tbh it wasn't an issue when I built this. I mainly copied the code here but probably it's not needed anymore https://github.com/artsy/eigen/blob/70571f97c97fb86cd8f0e997496107e33602f693/src/app/Components/WorksForYouArtworks.tsx#L126
src/app/Scenes/HomeViewSectionScreen/Artworks/HomeViewSectionScreenArtworks.tsx
Outdated
Show resolved
Hide resolved
src/app/Scenes/HomeViewSectionScreen/Artworks/HomeViewSectionScreenArtworks.tsx
Outdated
Show resolved
Hide resolved
src/app/Scenes/HomeView/Sections/ArtworksRailHomeViewSection.tsx
Outdated
Show resolved
Hide resolved
src/app/Scenes/HomeViewSectionScreen/Artworks/HomeViewSectionScreenArtworks.tsx
Outdated
Show resolved
Hide resolved
} | ||
|
||
export const ArtworksScreenHomeSection: React.FC<ArtworksScreenHomeSection> = ({ section }) => { | ||
const defaultViewOption = GlobalStore.useAppState((state) => state.userPrefs.defaultViewOption) |
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.
question: Without having a control to toggle between the two options, should we explicitly pick a view style rather than referring to this default?
src/app/Scenes/HomeViewSectionScreen/Artworks/HomeViewSectionScreenArtworks.tsx
Outdated
Show resolved
Hide resolved
|
||
// This won't happen because the query would fail thanks to the @principalField | ||
// Adding it here to make TS happy | ||
if (!data.homeView.section || !data.homeView.section.component?.title) { |
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 believe title
was already non-nullable but this PR should alleviate the other null checking here.
db88378
to
880220a
Compare
src/app/Scenes/HomeViewSectionScreen/Artworks/HomeViewSectionScreenArtworks.tsx
Outdated
Show resolved
Hide resolved
1a0477e
to
44c9d60
Compare
90727da
to
d26d9ae
Compare
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.
Looks good! Just one question below
@@ -192,6 +192,7 @@ function getDomainMap(): Record<string, RouteMatcher[] | null> { | |||
addRoute("/galleries-for-you", "GalleriesForYou"), | |||
addRoute("/gene/:geneID", "Gene"), | |||
addRoute("/home-view", "HomeView"), | |||
addRoute("/home-view/sections/:sectionID", "HomeViewSectionScreen"), |
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.
thought (non-blocking): Skimming the route list it occurs to me that there isn't really a good way of telling which routes are dev-only (L194) or Eigen-only (L194–195). The vast majority of these routes are also valid public routes on web, but not all. I wonder if we'd consider some added structure to this list 🤔 (but not for this PR).
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.
Yes, that's in the pipeline for next quarter with Sapphire. We are thinking of adjusting this file and making things easier here
@@ -22,7 +22,7 @@ export const ArtworksRailHomeViewSection: React.FC<ArtworksRailHomeViewSectionPr | |||
const data = useFragment(fragment, section) | |||
const title = data.component?.title | |||
const artworks = extractNodes(data.artworksConnection) | |||
const componentHref = data.component?.behaviors?.viewAll?.href | |||
const componentHref = "home-view/sections/" + data.internalID |
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.
question: Shouldn't this prefer to navigate to the viewAll.href
if it is provided, and only provide the generic full-screen experience here if viewAll.href
is falsy?
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.
Yes, I think we were agreeing on this behavior (response 2): artsy/metaphysics#5963 (comment)
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.
Good point - I will the MP changes to reflect that the default behaviour is what we need here.
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 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 made some changes here and added a new helper for future use
3673518
to
76f9ea2
Compare
Lol I messed up git history 😄 - sorry for the many commits |
Going to merge this PR before I need to merge conflicts from 10 commits - I addressed all review comments above and will be glad to address any others that come up |
[Ready for view as of Monday 9th, September]
This PR resolves ONYX-1159
Description
This PR adds a new screen generic type that will render a list of artworks.
Screen.Recording.2024-09-09.at.12.07.53.mov
Screen.Recording.2024-09-09.at.15.44.06.mov
PR Checklist
To the reviewers 👀
Changelog updates
Changelog updates
Cross-platform user-facing changes
iOS user-facing changes
Android user-facing changes
Dev changes
Need help with something? Have a look at our docs, or get in touch with us.