Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: Server does not refresh sub-section content if the section was created after launch #12230

Closed
brookmiles opened this issue Mar 10, 2024 · 4 comments · Fixed by #12259

Comments

@brookmiles
Copy link

brookmiles commented Mar 10, 2024

What version of Hugo are you using (hugo version)?

hugo v0.123.8-5fed9c591b694f314e5939548e11cc3dcb79a79c windows/amd64 BuildDate=2024-03-07T13:14:42Z VendorInfo=gohugoio

Microsoft Windows [Version 10.0.19045.4046]

Does this issue reproduce with the latest release?

Yes.

Issue does not appear to be present in hugo v0.119.0-b84644c008e0dc2c4b67bd69cccf87a41a03937e windows/amd64 BuildDate=2023-09-24T15:20:17Z VendorInfo=gohugoio which is the previous build I had been using until recently.

Description

While running hugo server, changes made to the content of newly created sub-sections will not be reflected in the browser after they are initially created. Restarting hugo reflects the updated content, and future changes are reflected correctly in any sub-sections which existed prior to hugo being launched.

Since I'm currently working on a site structured as a hierarchical directory, I'm running into this a lot, requiring a restart of hugo server each time I add a new sub-section.

Steps to reproduce

Create new site and theme

hugo new site test-site
cd test-site
hugo new theme test-theme

Edit hugo.toml to add theme = 'test-theme'.

Launch hugo server

hugo server -D

The -D is not required, but useful as the default archetype is set to draft, so this simplifies the test. Alternatively, edit archetypes/default.md to remove draft = true.

In another terminal, create a top level section

hugo new content/top-section/_index.md

Navigate to http://localhost:1313/top-section/ in your browser and observe the section has been created.

Make a noticeable change to the content of content/top-section/_index.md and save the file. Note the change is reflected in the browser.

Create a sub-section

hugo new content/top-section/sub-section/_index.md

The new section is reflected in the browser. Navigate to the new section.

Make a noticeable change to the content of content/top-section/sub-section/_index.md and save the file.

Unlike the change made to the top level section, changes made to the sub-section are not reflected in browser, either automatically, or by manually forcing a page refresh. Additional changes made to the file will also not be reflected.

Also note that the change to the sub section content is also not reflected in the sub-section summary when viewing the top level section.

Terminate and re-launch hugo.

hugo server -D

Note that the updated content of sub-section is reflected in the browser as expected.

Make a noticeable change to the content of content/top-section/sub-section/_index.md.

This and all further changes to the existing sub-section should now be reflected in the browser.

@bep
Copy link
Member

bep commented Mar 13, 2024

@jmooring assuming you tested this, what OS did you run it on? I have ran through the above recipe a few times, but it seem to work fine with me on MacOS.

@jmooring
Copy link
Member

Tested on Windows, will retest.

@jmooring
Copy link
Member

I can consistently reproduce this on Windows 11 with hugo v0.124.0-DEV-9ca1de09

@bep bep changed the title server does not refresh sub-section content if the section was created after launch Windows: Server does not refresh sub-section content if the section was created after launch Mar 14, 2024
bep added a commit to bep/hugo that referenced this issue Mar 15, 2024
This commit also optimizes for the case where change events for both file (e.g. `_index.md`) and the container directory comes in the same event batch.

While testing this on Windows 11 (ARM64), I notice that Windows behaves a little oddly when dumping a folder of files into the content tree; it works (at least after this commit), but it seems like the event batching behaves differently compared to other OSes (even older Win versions).

A related tip would be to try starting the server with polling, to see if that improves the situation, e.g.:

```
hugo server --poll 700ms
```

Fixes gohugoio#12230
bep added a commit that referenced this issue Mar 15, 2024
This commit also optimizes for the case where change events for both file (e.g. `_index.md`) and the container directory comes in the same event batch.

While testing this on Windows 11 (ARM64), I notice that Windows behaves a little oddly when dumping a folder of files into the content tree; it works (at least after this commit), but it seems like the event batching behaves differently compared to other OSes (even older Win versions).

A related tip would be to try starting the server with polling, to see if that improves the situation, e.g.:

```
hugo server --poll 700ms
```

Fixes #12230
Copy link

github-actions bot commented Apr 6, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants