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

Fix #883 - Cell Operation Names not PascalCased #888

Merged
merged 1 commit into from
Jul 26, 2020

Conversation

dthyresson
Copy link
Contributor

Fixes #883

As of v0.14.0, cell queries now get an operation name to work with Storybook:

See: #867

Example:

export const QUERY = gql`
- query {
+ query TestQuery {
    userProfile {
     id
   }
  }
`

I created a cell via the generator:

yarn rw g cell my_sites

and

✔ Generating cell files...
    ✔ Writing 
`./web/src/components/MySitesCell/MySitesCell.mock.j
s`...
    ✔ Writing 
`./web/src/components/MySitesCell/MySitesCell.storie
s.js`...
    ✔ Writing 
`./web/src/components/MySitesCell/MySitesCell.test.j
s`...
    ✔ Writing `./web/src/components/MySitesCell/MySi
tesCell.js`...
✨  Done in 1.57s.

the files, used the MySite upper camelCasing (aka Pascal Case).

However, my query operation name is

export const QUERY = gql`
  query my_sitesQuery {
    mySites {
      id
    }
  }
`

This PR:

  • pascal cases the operation name
  • adds test for snakeCase file name input: user_profile
  • adds test for kebabCase file name input: user-profile
  • adds test for camelCase file name input: userProfile

that all expect the UserProfileQuery operation name.

@peterp
Copy link
Contributor

peterp commented Jul 25, 2020

Thanks for this <3

@peterp peterp merged commit 6e91f1e into redwoodjs:main Jul 26, 2020
@peterp peterp added this to the next release milestone Jul 27, 2020
@dthyresson dthyresson deleted the dt-rw-cli-g-cell-operation-casing branch December 23, 2021 22:52
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.

Cell Query Operation name not camelCase-d if use underscore in generation
2 participants