Setting system.site:page.front not working correctly.

Created on 4 December 2024, 17 days ago

Problem/Motivation

I found this issue while working on a test that sets a node as the homepage. It appears that I can set the system.site config homepage value, but Drupal will not respect that without some kind of cache clear.

Steps to reproduce

See attached test case.

Notes...

Two observations I have...
I think that the BrowserTestBase::initFrontPage() is what's priming the cache with the front page of "Log in"...?
When I set the homepage via the browser (logging in, going to admin page, saving value), it seems to work as expected.

Proposed resolution

I'm not really sure what should be done to fix this...? It seems there may be something cached that is not getting cleared by the cache tag invalidation...?

Remaining tasks

User interface changes

N/a

Introduced terminology

N/a

API changes

N/a

Data model changes

N/a

Release notes snippet

N/a

πŸ› Bug report
Status

Active

Version

10.3 ✨

Component

configuration system

Created by

πŸ‡ΊπŸ‡ΈUnited States dpagini

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @dpagini
  • Pipeline finished with Failed
    17 days ago
    Total: 99s
    #359171
  • This is tested in a few places by necessity but in core/modules/system/tests/src/Functional/System/FrontPageTest.php specificallly. Is that test missing something?

  • πŸ‡ΊπŸ‡ΈUnited States dpagini

    Hey @cilefen, thanks for the updates to the issue, and great question. Wanted to first mention that I was only testing this within my project which was on 10.3, so I was certain the issue was there, but I do suspect this is also on 11.x as well.

    Yeah, so I had the exact same thought and referenced that test you mentioned as I was trying to figure out what was going on. The best thought I can come up with is that this test is logging a user into Drupal (specifically with "access content" perm which is needed for the `/node` view), whereas my test is just accessing anonymously. I also thought that maybe my test would need to assign the "access content" permission, but I would have expected to see a 403 error if that was the case... instead I get a 200 status with the default /user/login page, so I don't think it's a permission error either. Maybe the logged in user approach is affecting the cache being served, maybe? I think that's probably the right path, but I don't have an exact answer... b/c that ::initFrontPage() method is requesting the homepage as anonymous, and my test is then doing the same thing. Whereas in this existing core test, the setup is still requesting the homepage as anonymous, but the 2nd request to the homepage is with a logged in user.

    Did you have a chance to view the test I put up? Would you agree that what I'm doing in that test should be working?

Production build 0.71.5 2024