Skip to content

Document that invalidate on current URL reloads the page #4864

@tv42

Description

@tv42

Describe the problem

The docs for invalidate at https://kit.svelte.dev/docs/modules#$app-navigation-invalidate say

Causes any load functions belonging to the currently active page to re-run if they fetch the resource in question.

The way it is written, it sounds like "if load calls fetch with URL X, then invalidate(X) reloads the page".

However, observed behavior is that you can also invalidate the page itself.

https://stackoverflow.com/questions/71743867/refresh-current-page-in-sveltekit

I think this should be explicitly documented, both for discoverability and to say that that is the intended behavior, not a random side effect that might go away.

Describe the proposed solution

Causes any load functions belonging to the currently active page to re-run if they fetch the resource in question, or if the current page URL is invalidated.

Alternatives considered

Do only what the docs promised, but then something else needs to provide the reload functionality -- not a good idea, and breaks existing code.

Importance

would make my life easier

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions