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

Watch for render changes, getPageBlocks done #142

Open
spyderdsn opened this issue Feb 7, 2024 · 1 comment
Open

Watch for render changes, getPageBlocks done #142

spyderdsn opened this issue Feb 7, 2024 · 1 comment

Comments

@spyderdsn
Copy link

How to know when page blocks are done and DOM is fully updated? Is there any callback function?

const { data: blockMap } = useAsyncData('page_nuxt', () => $notion.getPageBlocks(pageUrl))

at the moment I'm using timeout but it is not always reliable:

await nextTick(() => {
    setTimeout(() => {
      document.body.scrollTop = 0 // For Safari
      document.documentElement.scrollTop = 0
      animations.apply('.notion', 'animated fade-in-right')
      isLoading.value = false
    }, 1500)
  })
@janniks
Copy link
Owner

janniks commented Feb 9, 2024

Hmm, I assume as soon as the Promise resolves (the await finishes) all blocks are in the response. The helper (API call collects all the blocks). Maybe I’m missing something… 🤔

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