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's handler called many time after render #22

Open
alejo-acevedo-deel opened this issue Jan 10, 2023 · 4 comments
Open

Page's handler called many time after render #22

alejo-acevedo-deel opened this issue Jan 10, 2023 · 4 comments
Labels
difficulty-reproducing Unable to reproduce thus far

Comments

@alejo-acevedo-deel
Copy link

I am using a Page component to show a table, into the handler of the Page I am calling a function to query a DB and this function is called many times ramdomly which could be a bit problematic

Example:

export default new Page({
  name: 'Users',
  handler: async () => {
    const data = await getAllUsers()

    return new Layout({
    .
    .
    .

getAllUsers() is being called many times

Solution

Handler should be executed only once at the moment of render the page, or even better it would be nice have a way to control it. At least it would be necessary have a some explanation on the documentation when and why the handler function is executed.

@danphilibin
Copy link
Contributor

Hi - which version of our SDK are you using? And are you seeing this in the Development or Production environment?

@jacobmischka
Copy link
Collaborator

Sorry, what do you mean by "randomly"? Is any navigation happening? Is the page just sitting idle?

@alejo-acevedo-deel
Copy link
Author

Hi - which version of our SDK are you using? And are you seeing this in the Development or Production environment?

I am using "@interval/sdk": "^0.36.0" at development enviroment

@alejo-acevedo-deel
Copy link
Author

Sorry, what do you mean by "randomly"? Is any navigation happening? Is the page just sitting idle?

When you recharge the page, the getAllUsers method is called many time when with just one call would be enough

@jacobmischka jacobmischka added the difficulty-reproducing Unable to reproduce thus far label Jan 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty-reproducing Unable to reproduce thus far
Projects
None yet
Development

No branches or pull requests

3 participants