Hot reload doesn't re-run page query until I save twice
See original GitHub issueWhen I modify a page query, I have to save twice for hot reload to re-run the page query.
Steps to reproduce
- Edit a page query
- Save
- Save
Expected result
run page queries
output after first save, for example:
success onPreExtractQueries - 0.009s
success extract queries from components - 0.032s
success write out requires - 0.002s
success run page queries - 0.011s - 1/1 88.96/s
success Re-building development bundle - 0.064s
Actual result
run page queries
output only after second save:
success onPreExtractQueries - 0.009s
success extract queries from components - 0.045s
success write out requires - 0.006s
success Re-building development bundle - 0.425s
success onPreExtractQueries - 0.009s
success extract queries from components - 0.032s
success write out requires - 0.002s
success run page queries - 0.011s - 1/1 88.96/s
success Re-building development bundle - 0.064s
I don’t think this is a recent thing; I just didn’t entirely recognize the issue I was having with hot reloads until now. “Try saving twice” didn’t really occur to me until this week, when I discovered the workaround.
Environment
Note my environments are WSL 2 on Windows 10. Easily reproduced in this repo; just edit the page query in src/pages/index.js
and note you’ll need to save twice to get the page query to re-run.
System:
OS: Linux 4.19 Debian GNU/Linux 9 (stretch) 9 (stretch)
CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
Shell: 4.4.12 - /bin/bash
Binaries:
Node: 12.18.3 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/bin/yarn
npm: 6.14.6 - /usr/local/bin/npm
Languages:
Python: 2.7.13 - /usr/bin/python
npmPackages:
gatsby: ^2.24.47 => 2.24.47
gatsby-source-sanity: ^6.0.4 => 6.0.4
and
System:
OS: Linux 4.19 Ubuntu 18.04.1 LTS (Bionic Beaver)
CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
Shell: 4.4.19 - /bin/bash
Binaries:
Node: 11.6.0 - /usr/bin/node
npm: 6.14.8 - /usr/bin/npm
Languages:
Python: 2.7.15 - /usr/bin/python
npmPackages:
gatsby: ^2.24.47 => 2.24.47
gatsby-source-sanity: ^6.0.3 => 6.0.3
npmGlobalPackages:
gatsby-cli: 2.4.11
Issue Analytics
- State:
- Created 3 years ago
- Reactions:8
- Comments:34 (22 by maintainers)
Top Results From Across the Web
Hot Reload Stops working after saving. - Visual Studio Feedback
Running a iOS or Android app on Visual Studio Mac. Hot Reloads works great until I save the file, and i do that...
Read more >Flutter - FutureBuilder fires twice on hot reload - Stack Overflow
It seems like the best way to forcibly rerun it is to override it with a new AsyncMemoizer(). You could do that easily...
Read more >Flutter Hot Reload doesn't re-run code | by Chema Molins |
The Flutter.io Using Hot Reload page says “ if the modified code won't be re-executed as a result of rebuilding the widget tree, ......
Read more >Refresh Power Query in Excel: 4 ways + advanced options
When we refresh, Power Query looks for a file called Example 6 – Data Refresh 1.csv. It doesn't know it is a different...
Read more >How to prevent the reloading of the whole page when I let the ...
Hello everyone, I am building a page which let the user to run a query against my database, once I have the data...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Published in
gatsby@2.24.74
I’ve had this issue intermittently as well. Looking at the changes between 2.24.9 and 2.24.10:
https://github.com/gatsbyjs/gatsby/compare/gatsby@2.24.9...gatsby@2.24.10
It looks like @ascorbic did some work in https://github.com/gatsbyjs/gatsby/pull/25815 that might have affected how fast-refresh and/or hot-reload work. @ascorbic what do you think?