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

page.server endpoints/server load functions can't trigger a layout.server rerun and refresh $page on the client #11415

Closed
mostrecent opened this issue Dec 20, 2023 · 4 comments

Comments

@mostrecent
Copy link

mostrecent commented Dec 20, 2023

Describe the problem

Sometimes you need to refresh "a global object" which was passed from layout.server but the refresh needs to happen from an children server load function/page.server endpoint (or to be more precise: should be triggered when a children endpoint is called).

Now, you can do this only with a full page reload or not using layout.server but ensuring that the object is sent with every endpoint/sever load func.

Describe the proposed solution

Option A, either some flag on the server load functions which let layout.server rerun

Option B, we can let hook.server pass stuff directly through the endpoints without manually passing stuff: locals.stuff in the server load func response

B should be actually covered by layouts (but, again, which do not rerun), so A might be more intuitive

Alternatives considered

No response

Importance

would make my life easier

Additional Information

No response

@mostrecent mostrecent changed the title page.server endpoints/serveer load functions can't trigger a layout.server rerun and refresh $page on the client page.server endpoints/server load functions can't trigger a layout.server rerun and refresh $page on the client Dec 20, 2023
@mostrecent
Copy link
Author

mostrecent commented Dec 20, 2023

I found that I can let layout.server rerun with adding await parent() to the children endpoints. But it does not change $page on the client in case the rerun gave new values. only those new from the children endpoint are populated in $page while those from layout stay the same from the first run

@mostrecent
Copy link
Author

Closed in favor of #9355

@mostrecent
Copy link
Author

Reopening because of #6315 (comment) and #9355 (comment)

@mostrecent mostrecent reopened this Dec 22, 2023
@eltigerchino
Copy link
Member

closing as duplicate of #9355

@eltigerchino eltigerchino closed this as not planned Won't fix, can't repro, duplicate, stale Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants