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

server: List page doesn't update after creating content #12362

Closed
jmooring opened this issue Apr 11, 2024 · 5 comments
Closed

server: List page doesn't update after creating content #12362

jmooring opened this issue Apr 11, 2024 · 5 comments

Comments

@jmooring
Copy link
Member

jmooring commented Apr 11, 2024

Reference: https://discourse.gohugo.io/t/hugo-server-d-doesnt-show-new-posts-consistently/49266

This worked as expected < v0.123.0.

archetypes/default.md

---
title: {{ replace .File.ContentBaseName "-" " " }}
draft: false
---

layouts/_default/list.html

{{ range .Pages }}{{ .Title }}|{{ end }}

content

content/
└── p1.md

actions

Run hugo server and look at the home page. You'll see p1| as expected.

In a new terminal, while the server is running, create a new page:

hugo new p2.md

expected

The home page should display p1|p2|

actual

The home displays p1| (no change)

test case

This isn't very helpful because it passes, but perhaps it will be useful as the basis for a different test.

integration test
func TestFoo(t *testing.T) {
	t.Parallel()

	files := `
-- hugo.toml --
disableKinds = ['rss','section','sitemap','taxonomy','term']
-- layouts/_default/list.html --
{{ range .Pages }}{{ .Title }}|{{ end }}
-- layouts/_default/single.html --
{{ .Title }}
-- content/p1.md --
---
title: p1
---
`

	b := hugolib.Test(t, files, hugolib.TestOptRunning())
	b.AssertFileContent("public/index.html", "p1|")

	b.AddFiles("content/p2.md", "---\ntitle: p2\n---").Build()
	b.AssertFileContent("public/index.html", "p1|p2|") // this test passes, which doesn't match reality
}

@bep
Copy link
Member

bep commented Apr 11, 2024

On what OS does this fail? Windows?

@jmooring
Copy link
Member Author

OP: hugo v0.124.1+extended linux/amd64 BuildDate=unknown
Me: hugo v0.124.1-db083b05f16c945fec04f745f0ca8640560cf1ec+extended linux/amd64

@bep
Copy link
Member

bep commented Apr 15, 2024

I have tested this again and cannot reproduce this on MacOS. I may eventually spin up a Linux VM and test this, but that may take some time.

@bep
Copy link
Member

bep commented Apr 16, 2024

I have a test repo that log the filesystem events for the different OSes. Looking at it now I see for created regular files:

MacOS:

CREATE        "/var/folders/h1/8hndypj13nsbj5pn4xsnv1tm0000gn/T/TestListEvents885546749/001/regularfile.txt"

Ubuntu:

CREATE        "/tmp/TestListEvents3296403036/001/regularfile.txt"
WRITE         "/tmp/TestListEvents3296403036/001/regularfile.txt"

In the hugolib.TestRunning we simulate these events (they doesn't get triggered with the mem fs, also they're very hard to get stable in CI).

But the above can explain what's seen above. I'll take another look.

Copy link

github-actions bot commented May 8, 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 May 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants