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

afterPageLoad is undocumented #122

Closed
Wolfr opened this issue May 22, 2020 · 8 comments
Closed

afterPageLoad is undocumented #122

Wolfr opened this issue May 22, 2020 · 8 comments

Comments

@Wolfr
Copy link
Collaborator

Wolfr commented May 22, 2020

The afterPageLoad hook was added in Routify 1.6, but it seems undocumented on the website.

@Wolfr
Copy link
Collaborator Author

Wolfr commented May 22, 2020

So this seems to fire, not when the page is loaded, but when you click the same link after the page has been loaded.

Possible starting code for documentation:

import { afterPageLoad } from "@sveltech/routify"
$afterPageLoad ((event, store) => {
  console.log("page x");
  return true;
})

Input welcome @jakobrosenberg .

@jakobrosenberg
Copy link
Member

I think this would be the correct approach for an example. return true is not needed since the hook called after the page change and thus can't guard anything. The store is not present in the parameters (it really shouldn't be in beforeUrlChange either, but breaking changes and all that).

import { afterPageLoad } from "@sveltech/routify"
$afterPageLoad ((page) => {
  console.log(page.title);
})

@Wolfr
Copy link
Collaborator Author

Wolfr commented May 23, 2020

I am trying to make docs for this in https://github.com/sveltech/routify-site-2020/tree/docs/afterpageload - but somehow the tree is reversing in order when I add a new item (url should be first and it last):

image

Can you check out what is going on?

@jakobrosenberg
Copy link
Member

@Wolfr there was an issue with sorting in previous versions, but it should be fixed in the most recent.

@Wolfr
Copy link
Collaborator Author

Wolfr commented May 23, 2020

if I switch up to @sveltech/routify": "^1.8.0-beta.7" I have the same problem unfortunately :/

@jakobrosenberg
Copy link
Member

I'll have a look tonight.

@Wolfr Wolfr mentioned this issue May 24, 2020
19 tasks
@Wolfr
Copy link
Collaborator Author

Wolfr commented May 24, 2020

I think you fixed that bug :) I'll continue work on this branch later.

@Wolfr
Copy link
Collaborator Author

Wolfr commented Jun 30, 2020

Afterpageload is now documented.

@Wolfr Wolfr closed this as completed Jun 30, 2020
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