Skip to content
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

Merged
merged 13 commits into from
Dec 14, 2017
Merged

Gene page refactor! #413

merged 13 commits into from
Dec 14, 2017

Conversation

alloy
Copy link
Contributor

@alloy alloy commented Dec 12, 2017

This separates the artists and artworks parts from the gene page.

@alloy alloy force-pushed the gene-page-refactor branch from 2a7221c to d1d2aa5 Compare December 12, 2017 00:16
@alloy
Copy link
Contributor Author

alloy commented Dec 12, 2017

Btw, there’s probably a few more places in Force where Reaction components are used that require the context setup.

@@ -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,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol

Copy link
Contributor Author

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

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, super informative, thanks!

@mzikherman
Copy link
Collaborator

mzikherman commented Dec 12, 2017

As a note (to myself) on what is still left to do in this PR:

  • 'artworks' mode:
    • Wire up being able to click on the filter dropdowns
    • Wire up headline display
    • Wire up being able to change the sort
    • Wire up for sale toggle
    • Wire up switching to 'artists' mode
    • Inf scroll/load more

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.

@alloy
Copy link
Contributor Author

alloy commented Dec 12, 2017

@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.

@mzikherman
Copy link
Collaborator

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.

@joeyAghion
Copy link
Contributor

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.

Copy link
Contributor Author

@alloy alloy left a 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
Copy link
Contributor Author

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",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😲

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:{{ will undo

@@ -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 : []
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to be reverted.

}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to be reverted.

node {
__id
}
}
...ArtworkGrid_artworks

Copy link
Contributor Author

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
}
Copy link
Contributor Author

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
}
Copy link
Contributor Author

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"}}>
Copy link
Contributor Author

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 :)

@mzikherman mzikherman changed the title [WIP] Gene page refactor Gene page refactor! Dec 14, 2017
sortStoriesByKind: true,
})

// TODO: Fix the below
Copy link
Collaborator

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?

@mzikherman mzikherman merged commit 9a53fe2 into relay-modern Dec 14, 2017
@mzikherman mzikherman deleted the gene-page-refactor branch December 14, 2017 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants