From 11457f66bb485ecff500e41f98ca16d123bb7d80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Sodi=C4=87?= Date: Tue, 16 Jul 2024 19:51:51 +0200 Subject: [PATCH] Fix tutorial text for 0.14.0 (#2185) --- web/docs/tutorial/02-project-structure.md | 2 +- web/docs/tutorial/05-queries.md | 6 +++--- web/docs/tutorial/06-actions.md | 4 ++-- web/docs/tutorial/07-auth.md | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/web/docs/tutorial/02-project-structure.md b/web/docs/tutorial/02-project-structure.md index 6e8e4bc7a..ae21e583c 100644 --- a/web/docs/tutorial/02-project-structure.md +++ b/web/docs/tutorial/02-project-structure.md @@ -32,7 +32,7 @@ After creating a new Wasp project, you'll get a file structure that looks like t The default project uses JavaScript. To use TypeScript, you must manually rename the file -`src/MainPage.jsx` to `src/MainPage.tsx`. +`src/MainPage.jsx` to `src/MainPage.tsx`. Restart `wasp start` after you do this. No updates to the `main.wasp` file are necessary - it stays the same regardless of the language you use. diff --git a/web/docs/tutorial/05-queries.md b/web/docs/tutorial/05-queries.md index cf164fb0f..5158c9d7d 100644 --- a/web/docs/tutorial/05-queries.md +++ b/web/docs/tutorial/05-queries.md @@ -101,8 +101,8 @@ export const getTasks: GetTasks = async (args, context) => { Wasp automatically generates the types `GetTasks` and `Task` based on the contents of `main.wasp`: -- `Task` is a type corresponding to the `Task` entity we've defined in `main.wasp`. -- `GetTasks` is a generic type Wasp automatically generated based on the `getTasks` Query we've defined in `main.wasp`. +- `Task` is a type corresponding to the `Task` entity you defined in `schema.prisma`. +- `GetTasks` is a generic type Wasp automatically generated based on the `getTasks` Query you defined in `main.wasp`. You can use these types to specify the Query's input and output types. This Query doesn't expect any arguments (its input type is `void`), but it does return an array of tasks (its output type is `Task[]`). @@ -230,7 +230,7 @@ Most of this code is regular React, the only exception being the two< - `getTasks` - The client-side Query function Wasp generated based on the `getTasks` declaration in `main.wasp`. - `useQuery` - Wasp's [useQuery](../data-model/operations/queries#the-usequery-hook-1) React hook, which is based on [react-query](https://github.com/tannerlinsley/react-query)'s hook with the same name. -- `Task` - The type for the Task entity defined in `main.wasp`. +- `Task` - The type for the Task entity defined in `schema.prisma`. Notice how you don't need to annotate the type of the Query's return value: Wasp uses the types you defined while implementing the Query for the generated client-side function. This is **full-stack type safety**: the types on the client always match the types on the server. diff --git a/web/docs/tutorial/06-actions.md b/web/docs/tutorial/06-actions.md index 5c111e227..05a93d071 100644 --- a/web/docs/tutorial/06-actions.md +++ b/web/docs/tutorial/06-actions.md @@ -175,7 +175,7 @@ const NewTaskForm = () => { -Unlike Queries, you can call Actions directly (i.e., without wrapping it with a hook) because we don't need reactivity. The rest is just regular React code. +Unlike Queries, you can call Actions directly (without wrapping them in a hook) because they don't need reactivity. The rest is just regular React code. @@ -265,7 +265,7 @@ style={{ border: "1px solid black" }}
:::note Automatic Query Invalidation -When you create a new task, the list of tasks is automatically updated to display the new task, even though we have not written any code that would do that! Wasp handles these automatic updates under the hood. +When you create a new task, the list of tasks is automatically updated to display the new task, even though you haven't written any code that does that! Wasp handles these automatic updates under the hood. When you declared the `getTasks` and `createTask` operations, you specified that they both use the `Task` entity. So when `createTask` is called, Wasp knows that the data `getTasks` fetches may have changed and automatically updates it in the background. This means that **out of the box, Wasp keeps all your queries in sync with any changes made through Actions**. diff --git a/web/docs/tutorial/07-auth.md b/web/docs/tutorial/07-auth.md index 51e6086de..46c74db35 100644 --- a/web/docs/tutorial/07-auth.md +++ b/web/docs/tutorial/07-auth.md @@ -278,11 +278,11 @@ style={{ border: "1px solid black" }} You'll notice that we now have a `User` entity in the database alongside the `Task` entity. -However, you will notice that if you try logging in as different users and creating some tasks, all users share the same tasks. That's because we haven't yet updated the queries and actions to have per-user tasks. Let's do that next. +However, you will notice that if you try logging in as different users and creating some tasks, all users share the same tasks. That's because you haven't yet updated the queries and actions to have per-user tasks. Let's do that next. -You might notice some extra Prisma models like `Auth`, `AuthIdentity` and `Session` that Wasp created for us. You don't need to care about these right now, but if you are curious, you can read more about them [here](../auth/entities). +You might notice some extra Prisma models like `Auth`, `AuthIdentity` and `Session` that Wasp created for you. You don't need to care about these right now, but if you are curious, you can read more about them [here](../auth/entities).