-
Notifications
You must be signed in to change notification settings - Fork 13
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
RFC: Merge types/ and fuse/ folders #101
Comments
Another idea: we go with the Prisma client approach and generate into node_modules instead? Fuse folder:
Client imports:
Pretty clean 🤔 |
I'm personally against generating into On the side I assume prisma went with generating into I guess the I am personally not sure whether we need to make this change as with the arrival of standalone we'll be able to avoid this confusion in general already. |
EDIT: Opened a PR to discuss this and avoid derailing this issue 🙈 #102I didn't even realize this! Looking at it, standalone requires a user to do these imports; that feels unintuitive because import { useQuery } from 'fuse/client'
import { graphql, useFragment } from '../../fuse' I strongly prefer it all to be imported from one place if we don't need a server/client component split. I'm guessing we can easily make that happen by adding
How does standalone avoid this confusion? Users are still writing things into a |
Mainly My thinking is mainly that it might not be needed to merge them or even not be needed to think about the special cases for embedding it in |
Summary
Right now, users interact with a
types/
folder that contains ~a file per node, and then Fuse generates afuse/
folder that people use from their client(s). (import { useQuery } from '@/fuse/client'
)Proposed Solution
I propose we centralize all of it into the
fuse/
folders. Users write their types in their, and then we also generate the files in there and they import from there from the client.First idea for a potential folder structure:
The big question is what happens to the client imports. With this structure, they'd look like
import { useQuery } from '@/fuse/_generated/client'
, which isn't great.Since
client.ts
,index.ts
,pages.ts
, andserver.ts
are simple re-exports of the underlying libraries and the really truly generated custom files arefragment-masking.ts
,gql.ts
, andgraphql.ts
, we could try this folder structure instead:This would fully preserve the client imports while centralizing everything else. The downside of this is that the
index/pages/server/client.ts
files get muddled with the types/nodes, and it's a bit of an odd semantics because users are meant to touchcontext.ts
but notserver.ts
— that's not intuitive.Another option that clearly marks
index/pages/server/client.ts
distinct from the types files would be to prefix them with a_
, just like we do with_generated
and_context
in the original example:But that makes client-side imports ugly.
import from '@/fuse/_client
😕 Also,_index.ts
obviously doesn't work forimport from '@/fuse'
so we'd need a different name for those exports.Any other ideas?
The text was updated successfully, but these errors were encountered: