mirror of
https://github.com/wasp-lang/wasp.git
synced 2024-12-27 19:14:52 +03:00
Fix tutorial text for 0.14.0 (#2185)
This commit is contained in:
parent
7a7b846f64
commit
11457f66bb
@ -32,7 +32,7 @@ After creating a new Wasp project, you'll get a file structure that looks like t
|
||||
<TabItem value="ts" label="TypeScript">
|
||||
|
||||
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.
|
||||
|
||||
|
@ -101,8 +101,8 @@ export const getTasks: GetTasks<void, Task[]> = 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 <ShowForJs>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.
|
||||
|
||||
|
@ -175,7 +175,7 @@ const NewTaskForm = () => {
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
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.
|
||||
|
||||
<ShowForTs>
|
||||
|
||||
@ -265,7 +265,7 @@ style={{ border: "1px solid black" }}
|
||||
<br />
|
||||
|
||||
:::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**.
|
||||
|
||||
|
@ -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.
|
||||
|
||||
<small>
|
||||
|
||||
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).
|
||||
|
||||
</small>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user