create-fate 1.11.1 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/templates/fate/graphql/AGENTS.md +1 -1
- package/templates/fate/graphql/README.md +1 -1
- package/templates/fate/graphql/client/src/fate/graphql.ts +1 -1
- package/templates/fate/graphql-client/README.md +1 -1
- package/templates/fate/graphql-client/src/fate/graphql.ts +1 -1
package/package.json
CHANGED
|
@@ -23,7 +23,7 @@ This guidance is for agents working in projects bootstrapped from the fate templ
|
|
|
23
23
|
- **Use ViewRefs:** Pass references instead of raw data. Keep components focused on views and `ViewRef`s to let fate manage data masking and updates.
|
|
24
24
|
- **Co-locate data needs:** Keep view definitions near their components and compose them upward to the request root for predictable fetching.
|
|
25
25
|
- **Use Suspense:** Wrap pages in `Suspense`/`ErrorBoundary` instead of ad-hoc loading/error flags; fate aligns with Async React by design.
|
|
26
|
-
- **Do not duplicate types:** Use `GraphQLEntities` from `client/.fate/
|
|
26
|
+
- **Do not duplicate types:** Use `GraphQLEntities` from `client/.fate/client.generated.ts` for GraphQL view types. The client mapping exports convenient aliases; avoid redefining entity shapes on the client. This ensures view selections stay type-safe end-to-end.
|
|
27
27
|
- **`useRequest` only at the root:** When adding routes or layouts, create a dedicated `useRequest` call per screen root that pulls together all child views; do not scatter `useRequest` across leaf components unless it's necessary to issue requests due to user input.
|
|
28
28
|
- **React Actions:** Prefer React Action-friendly UI primitives (buttons/forms that accept an `action` prop). If unavailable, wrap action calls with `startTransition` in `onClick` handlers.
|
|
29
29
|
- **fate client support** fate's local client support files are maintained by the Vite/fate tooling. Do not manually edit `.fate` files; make the proper schema changes on the server and run `pnpm fate:generate` when working outside Vite dev.
|
|
@@ -25,7 +25,7 @@ vp run --filter '@app/server' generate-graphql
|
|
|
25
25
|
vp run fate:generate
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
`client/src/fate/graphql.ts` maps query and mutation names. Client views use `GraphQLEntities` from `client/.fate/
|
|
28
|
+
`client/src/fate/graphql.ts` maps query and mutation names. Client views use `GraphQLEntities` from `client/.fate/client.generated.ts`, generated from your Pothos schema. Server data views handle live updates and authorization.
|
|
29
29
|
|
|
30
30
|
## Technologies
|
|
31
31
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import schema from '@app/server/src/graphql/schema.graphql?raw';
|
|
2
|
-
import type { GraphQLEntities } from '../../.fate/
|
|
2
|
+
import type { GraphQLEntities } from '../../.fate/client.generated.ts';
|
|
3
3
|
|
|
4
4
|
export type User = GraphQLEntities['User'];
|
|
5
5
|
export type Post = GraphQLEntities['Post'];
|
|
@@ -43,7 +43,7 @@ Replace `src/fate/schema.graphql` with your server's schema, then edit `src/fate
|
|
|
43
43
|
|
|
44
44
|
The sample schema includes `viewer`, `posts(first:, after:)`, `postLike(input:)`, `node(id:)`, and `nodes(ids:)`, with Relay-style connections. Replace these with your server's fields and arguments.
|
|
45
45
|
|
|
46
|
-
After changing the schema or mapping, run `vp run fate:generate`. Client views use `GraphQLEntities` from the generated `.fate/
|
|
46
|
+
After changing the schema or mapping, run `vp run fate:generate`. Client views use `GraphQLEntities` from the generated `.fate/client.generated.ts`. Schema types are erased from the browser bundle.
|
|
47
47
|
|
|
48
48
|
## Development
|
|
49
49
|
|