-
Notifications
You must be signed in to change notification settings - Fork 970
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
Cell Query Operation name not camelCase-d if use underscore in generation #883
Comments
Oooh, great catch, PascalCase is what I wanted 👍 |
@dthyresson Any interest in creating a PR for this? 🍫 |
@peterp Happy to! |
Oh, I see that:
is already used in
So, thinking it's just something like: const uniqueOperationName = (name, index = 1) => {
let operationName =
index <= 1
? `${pascalcase(name)}Query`
: `${pascalcase(name)}Query_${index}`
if (!getCellOperationNames().includes(operationName)) {
return operationName
}
return uniqueOperationName(name, index + 1)
} and then adding some more tests for single, multi (and change the expected case) and then an underscore and a dash scenarios along the line of:
|
Right because, usually your component name will not be pascal cased:
|
…sing Fix #883 - Cell Operation Names not PascalCased
As of v0.14.0, cell queries now get an operation name to work with Storybook:
See: #867
Example:
I created a cell via the generator:
yarn rw g cell my_sites
and
the files, used the
MySite
upper camelCasing.However, my query operation is
When I generated
SitesCell
it isI expected either
query MySitesQuery {
or
``query mySitesQuery {`
but not
``query my_sitesQuery {`
That said:
yarn rw g cell MySites
yarn rw g cell mySites
generates
Is there a preferred case?
I noticed that in the GraphQL documentation the example is PascalCase:
The text was updated successfully, but these errors were encountered: