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

Better GraphQL (FOR REFERENCE) #1076

Draft
wants to merge 15 commits into
base: fix-sass
Choose a base branch
from
Draft

Conversation

lorenjohnson
Copy link
Member

@lorenjohnson lorenjohnson commented Jan 21, 2022

This branch standardizes our GraphQL usage throughout the app and includes a few proposals for that standard.

There are a few things going on here and despite the size and difficulty of the diff, this refactors only some syntax and naming conventions.

  • Converts all .graphql files to js using graphql-tag (gql) exclusively for those files (side benefit: no more rebooting of dev server to reflect changes to GraphQL queries--yay!)
  • Converts every GraphQL query or mutation throughout the app to be encapsulated in a gql tag and formatted consistently with a line break before and after the backticks (which I'm suggesting we standardize upon).
  • Converts everything within GraphQL queries which was previously plain string interpolation into fragments, including moving things that were previously function parameters to GraphQL variables (e.g. $withComments), proving default values in the surrounding variable definitions where appropriate (mirroring previous behavior of the wrapping function). This may take a little getting used to if embrace that as the standard, but once grok'd I think it will keep us on our toes with GraphQL usage in a good way.
  • Renames all GraphQL query files to be PascalCase (e.g. peopleQuery.js to PeopleQuery.js), did the same for all inline GraphQL query and mutations throughout (e.g. personQuery to PersonQuery, etc). This naming convention is meant to delineate when we're using a parsed GraphQL AST object vs anything else. If for some reason we still wanted to string interpolate our way to a GraphQL query we would use normal snakeCase for the variable name signaling the difference.

There are on purpose several choices and opinions expressed in these changes which I'd happily visit together when we get a chance.

NOTE: Depending on your local Git case sensitivity setting you may have some difficulty checking-out this branch locally as it does some case-sensitive file renaming. Please feel free to ping me if you want support on that, I've just been through that loop :)

@lorenjohnson lorenjohnson changed the title Better graphql step 1 Better GraphQL - Phase 1 Jan 21, 2022
@levity levity had a problem deploying to hylo-evo-staging-pr-1076 January 21, 2022 02:23 Failure
@lorenjohnson lorenjohnson changed the base branch from dev to 952-loading-performance-graphql January 21, 2022 02:23
@levity levity temporarily deployed to hylo-evo-staging-pr-1076 January 21, 2022 03:24 Inactive
@codecov
Copy link

codecov bot commented Jan 21, 2022

Codecov Report

Merging #1076 (2411343) into fix-sass (3d59a5a) will decrease coverage by 0.14%.
The diff coverage is 52.38%.

Impacted file tree graph

@@             Coverage Diff              @@
##           fix-sass    #1076      +/-   ##
============================================
- Coverage     51.34%   51.19%   -0.15%     
============================================
  Files           502      497       -5     
  Lines         10233    10303      +70     
  Branches       2631     2703      +72     
============================================
+ Hits           5254     5275      +21     
- Misses         4979     5028      +49     
Impacted Files Coverage Δ
src/components/CreateGroup/CreateGroup.store.js 43.58% <ø> (ø)
src/components/CreateTopic/CreateTopic.store.js 100.00% <ø> (ø)
...nents/EventInviteDialog/EventInviteDialog.store.js 75.00% <ø> (ø)
src/components/FlagContent/FlagContent.store.js 100.00% <ø> (ø)
src/components/HyloEditor/HyloEditor.store.js 57.14% <ø> (ø)
...rc/components/LocationInput/LocationInput.store.js 9.52% <ø> (-0.48%) ⬇️
src/components/PostCard/PostBody/PostBody.store.js 36.36% <ø> (ø)
...components/PostCard/PostHeader/PostHeader.store.js 81.13% <ø> (ø)
src/components/PostEditor/PostEditor.store.js 65.00% <ø> (ø)
...rc/components/SkillsSection/SkillsSection.store.js 39.65% <ø> (ø)
... and 114 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3d59a5a...2411343. Read the comment docs.

@lorenjohnson lorenjohnson temporarily deployed to hylo-evo-staging-pr-1076 January 21, 2022 07:39 Inactive
@lorenjohnson lorenjohnson temporarily deployed to hylo-evo-staging-pr-1076 January 21, 2022 18:55 Inactive
@lorenjohnson lorenjohnson temporarily deployed to hylo-evo-staging-pr-1076 January 22, 2022 19:20 Inactive
@lorenjohnson lorenjohnson temporarily deployed to hylo-evo-staging-pr-1076 January 22, 2022 19:26 Inactive
@lorenjohnson lorenjohnson temporarily deployed to hylo-evo-staging-pr-1076 January 22, 2022 19:51 Inactive
@lorenjohnson lorenjohnson changed the base branch from 952-loading-performance-graphql to fix-sass January 23, 2022 21:34
@lorenjohnson lorenjohnson temporarily deployed to hylo-evo-staging-pr-1076 January 23, 2022 21:41 Inactive
@lorenjohnson lorenjohnson temporarily deployed to hylo-evo-staging-pr-1076 January 24, 2022 05:57 Inactive
@lorenjohnson lorenjohnson changed the title Better GraphQL - Phase 1 Better GraphQL (FOR REFERENCE) Oct 21, 2022
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.

2 participants