Skip to content

Commit ea2b060

Browse files
fix(api-connection): re-enable nx daemon to fix fastapi code generation hot reload (#335)
* fix(api-connection): re-enable nx daemon to fix fastapi code generation hot reload The nx watch command requires the nx daemon to be running. nx watch is required for detecting changes to the api and regenerating the client for serve-local Fixes #333 * docs: add nx troubleshooting page and warning re daemon and nx watch * docs: update translations * docs: fix translations --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 11611e4 commit ea2b060

File tree

20 files changed

+2388
-1021
lines changed

20 files changed

+2388
-1021
lines changed

docs/astro.config.mjs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,33 @@ export default defineConfig({
341341
},
342342
],
343343
},
344+
{
345+
label: 'Troubleshooting',
346+
translations: {
347+
jp: 'トラブルシューティング',
348+
ko: '문제 해결',
349+
fr: 'Dépannage',
350+
it: 'Risoluzione dei problemi',
351+
es: 'Solución de problemas',
352+
pt: 'Solução de problemas',
353+
zh: '故障排除',
354+
},
355+
items: [
356+
{
357+
label: 'Nx',
358+
translations: {
359+
jp: 'Nx',
360+
ko: 'Nx',
361+
fr: 'Nx',
362+
it: 'Nx',
363+
es: 'Nx',
364+
pt: 'Nx',
365+
zh: 'Nx',
366+
},
367+
link: '/troubleshooting/nx',
368+
},
369+
]
370+
},
344371
{
345372
label: 'About',
346373
translations: {

docs/src/content/docs/en/guides/api-connection/react-fastapi.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ For more fine-grained control, you can use the `watch-generate:<ApiName>-client`
121121
/>
122122
:::
123123

124+
:::warning
125+
`watch-generate:<ApiName>-client` relies on the [`nx watch`](https://nx.dev/docs/guides/tasks--caching/workspace-watching) command, which requires the [Nx Daemon](https://nx.dev/docs/concepts/nx-daemon) to be running. Therefore if you have disabled the daemon, the client won't automatically regenerate when making changes to your FastAPI.
126+
:::
127+
124128
### Using the API Hook
125129

126130
The generator provides a `use<ApiName>` hook which you can use to call your API with TanStack Query.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
title: Troubleshooting Nx
3+
description: Troubleshooting issues with Nx
4+
---
5+
import NxCommands from '@components/nx-commands.astro';
6+
7+
This page provides some troubleshooting guidance for issues you may encounter when using Nx.
8+
9+
## Nx Daemon
10+
11+
The [Nx Daemon](https://nx.dev/docs/concepts/nx-daemon) is a process which continuously watches for workspace changes in order to recompute its project graph. This provides a performance boost, particularly for large projects, but can sometimes be the cause of issues depending on your environment.
12+
13+
This can manifest itself in different ways, one of which is the following error:
14+
15+
```bash
16+
NX Could not find project "@scope/project"
17+
18+
Pass --verbose to see the stacktrace.
19+
```
20+
21+
For this, and any other unexpected error, it's always worth resetting Nx and retrying in case of a daemon issue. You can use the following command:
22+
23+
<NxCommands commands={['reset']} />
24+
25+
Failing this, you can try [disabling the daemon altogether](https://nx.dev/docs/concepts/nx-daemon#turning-it-off).
26+
27+
:::warning
28+
The `nx watch` command requires the daemon, and therefore some of your hot-reloading targets may not function if you disable it.
29+
:::

0 commit comments

Comments
 (0)