-
Notifications
You must be signed in to change notification settings - Fork 74
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
Gene page refactor! #413
Gene page refactor! #413
Conversation
Signed-off-by: Eloy Durán <[email protected]>
2a7221c
to
d1d2aa5
Compare
Btw, there’s probably a few more places in Force where Reaction components are used that require the context setup. |
src/Components/Gene/NewContents.tsx
Outdated
@@ -36,7 +36,7 @@ class GeneNewContents extends React.Component<Props, State> { | |||
|
|||
onDropdownSelect(slice: string, value: string) { | |||
this.setState({ | |||
[slice.toLowerCase()]: value, | |||
[slice.toLowerCase() as any]: value, |
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.
lol
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.
Yep 😝
In short, Pick
currently only works when literals are used as keys, or of course ‘anything’. See the linked SO Q/A and the TS issue the answer links to https://stackoverflow.com/questions/42090191/picks-k-type-with-dynamic-computed-keys/42131589#42131589
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.
Wow, super informative, thanks!
As a note (to myself) on what is still left to do in this PR:
Then on Force, the code which initializes the Reaction component should update to support the new style: rendering this component and passing in the gene props from the bootstrapped sharify data. |
@mzikherman Here’s an example I could easily find that also needs updating to use a QueryRenderer https://github.com/artsy/force/blob/7f8984a814e2d9a8895330826f0f2802c69f0ba7/desktop/apps/tag/client.js. That might actually be the only other place. |
Yup, I totally forgot about the tag page but I now recall those two (gene + tag) being the places where the new filter + bricks were being used. I can doublecheck but I yea, I think those are the only two. |
Thanks @mzikherman for linking me to this. I didn't realize this was happening with the Relay upgrade. Since there were several of issues with the current gene page implementation (artsy/force#1823, artsy/force#1822, artsy/force#1821), this is a great and rare opportunity to carefully review the actual requests that cascade from the page (including requests from Force's client-side, from its server-side, from MP, and so on). We have new MP response properties, Datadog traces, and staging logs to help with this. |
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 guess the attempt at using an interface for the artwork edge only still compiled because the interface is still present in your local MP schema?
pageInfo { | ||
hasNextPage | ||
endCursor | ||
} | ||
edges { | ||
...ArtworkGrid_artworks |
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.
Oh, these attempts at using an interface will have to be reverted!
package.json
Outdated
@@ -22,7 +22,7 @@ | |||
"test:watch": "jest --watch --runInBand", | |||
"storybook": "node verify-node-version.js && concurrently --kill-others 'yarn relay --watch' 'env GRAPHQL_NO_NAME_WARNING=true start-storybook -p 9001'", | |||
"deploy-storybook": "yarn relay && NODE_ENV=production storybook-to-ghpages", | |||
"sync-schema": "cd externals/metaphysics && git fetch && git checkout origin/master && yarn install && npm run dump-schema -- ../../data", | |||
"sync-schema": "cd externals/metaphysics && git fetch && git checkout origin/pagination_fuckery && yarn install && npm run dump-schema -- ../../data", |
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.
:{{ will undo
src/Components/ArtworkGrid.tsx
Outdated
@@ -51,7 +51,7 @@ export class ArtworkGrid extends React.Component<Props, State> { | |||
sectionedArtworks() { | |||
const sectionedArtworks: ArtworkRelayProps[][] = [] | |||
const sectionRatioSums = [] | |||
const artworks = this.props.artworks ? this.props.artworks.edges : [] | |||
const artworks = this.props.artworks ? this.props.artworks : [] |
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.
Needs to be reverted.
src/Components/ArtworkGrid.tsx
Outdated
} | ||
|
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.
Needs to be reverted.
src/Components/Gene/Contents.tsx
Outdated
node { | ||
__id | ||
} | ||
} | ||
...ArtworkGrid_artworks | ||
|
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.
Needs to be reverted.
...ArtworkGrid_artworks | ||
edges { | ||
...ArtworkGrid_artworks | ||
} |
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.
Needs to be reverted.
image_url | ||
image { | ||
url | ||
} |
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 will probably lead to a merge error with work that @xtina-starr and @yuki24 have been doing.
return ( | ||
<div> | ||
<GeneExample geneID="old-master-influenced-fantasy" /> | ||
< ContextProvider currentUser={{id: "58ed621f9c18db55bc6b2dde", name: "Matt", accessToken: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI1OGVkNjIxZjljMThkYjU1YmM2YjJkZGUiLCJzYWx0X2hhc2giOiI2ZTVkMWVhYzJmMWQzNDhmZmZmOGJmMDAyOGQ1OTViOCIsInJvbGVzIjoidXNlciIsInBhcnRuZXJfaWRzIjpbXSwiZXhwIjoxNTE3NzYwMjA0LCJpYXQiOjE1MTI1NzYyMDQsImF1ZCI6IjRlMzZlZmE0ZGI0ZTMyMDAwMTAwMDM1OSIsImlzcyI6IkdyYXZpdHkiLCJqdGkiOiI1YTI4MTRjYzhiM2I4MTQ1ZjI2YTliNzUifQ.ksCRUaQRvGNRW2VnOSAAT32r9PM9s04axn7SqI-_Kno"}}> |
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.
Still got a token in there :)
sortStoriesByKind: true, | ||
}) | ||
|
||
// TODO: Fix the below |
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.
@orta this seems to be broken with the latest version of storybook- would you be able to look into it?
This separates the artists and artworks parts from the gene page.