Skip to content

Commit ef94339

Browse files
committed
docs: update full reload doc
1 parent b30a987 commit ef94339

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -208,16 +208,6 @@ await import('./app.js?v=2')
208208

209209
If you execute this code, and modify the app.js file between the two imports, then the second import will load the latest version of the module you've saved.
210210

211-
### Full reload
212-
213-
Now, how do we perform a full reload? How do we force Node.js to reload the entire process?
214-
215-
For this, there's no secret : you will need a process manager. Whenever a file listed in `reload`, or a file containing the `import.meta.hot?.decline()` instruction is modified, Hot Hook will by default send a message to the parent process to tell it to reload the module. But for that, you need a parent process. And a parent process that understands this instruction.
216-
217-
So the concept is simple: the manager needs to launch your application as a child process and listen to messages from the child process. If the child process sends a message asking for a full reload, then the manager must kill the child process and restart it.
218-
219-
It's quite simple. However, we ship a process manager with Hot Hook. See the documentation of the runner [here](./packages/runner/) for more information, and also see the examples in the [examples](./examples/) folder that use the runner.
220-
221211
### Boundary
222212

223213
"HMR boundaries" are an important concept in Hot Hook. The so-called "boundary modules" are modules that are marked as being hot reloadable using the `import.meta.hot?.boundary` attribute during their importation :
@@ -248,6 +238,16 @@ In this example, `users_controller.ts` and `posts_controller.ts` are boundary fi
248238
- `utils/helpers.ts` is also hot reloadable because the only path to reach the root file goes through `users_controller.ts`, which is a boundary file.
249239
- Now, more interestingly, `app/models/user.ts` is NOT hot reloadable. Because there are TWO paths to reach the root file. The first goes through `users_controller.ts`, which is a boundary file, but the second goes through `providers/database.ts`, which is not a boundary file. Therefore, Hot Hook cannot hot reload `app/models/user.ts`. A modification to this file would require a full reload of the server. If `providers/database.ts` did not import `app/models/user.ts`, then `app/models/user.ts` would be hot reloadable.
250240

241+
### Full reload
242+
243+
Now, how do we perform a full reload? How do we force Node.js to reload the entire process?
244+
245+
For this, there's no secret : you will need a process manager. Whenever a file that should trigger a full reload is updated, Hot Hook will send a message to the parent process to tell it to reload the module. But for that, you need a parent process. And a parent process that understands this instruction.
246+
247+
So the concept is simple: the manager needs to launch your application as a child process and listen to messages from the child process. If the child process sends a message asking for a full reload, then the manager must kill the child process and restart it.
248+
249+
It's quite simple. However, we ship a process manager with Hot Hook. See the documentation of the runner [here](./packages/runner/) for more information, and also see the examples in the [examples](./examples/) folder that use the runner.
250+
251251
### Hot Hook
252252

253253
With all that, Hot Hook is ultimately quite simple:

0 commit comments

Comments
 (0)