sveltejs / sveltejs/kit

Event that is triggered when Page is fully rendered

Open
#15,049 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the problem

I need to send a signal back to a third-party server only after the ENTIRE page is fully rendered. I am a third-party library so I don't know the intricacies of any sveltekit site's architectural specifics.

I am looking for something like or to analogous to DOMContentLoaded or onload but understands SvelteKit pages and triggers after the page is fully rendered.

There are 3 candidates and each seem unsuitable:

onMount: This is close to what I need but at Page level rather than component level. I don't know the individual components in a page. I also don't know which component will be last to render (I don't know the hierarchy of components).

load: This happens before mounting.

afterNavigate: This may be what I need but the documentation doesn't make it 100% clear.

Is there a way I can inject it so that it applies at page level rather than at individual component levels?

Describe the proposed solution

Not sure. Maybe afterNavigate is what I need.

Alternatives considered

No response

Importance

i cannot use SvelteKit without it

Additional Information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the SvelteKit lifecycle entry points mentioned in the issue: onMount, load, and afterNavigate. Determine whether afterNavigate runs after a page is fully rendered and whether a page-level injection point is needed; done means the supported behavior or required API is clearly documented and verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.