Skip to content

feat: add onReady feature#34

Open
goooseman wants to merge 4 commits intoRowno:masterfrom
goooseman:feat/on-ready-callback
Open

feat: add onReady feature#34
goooseman wants to merge 4 commits intoRowno:masterfrom
goooseman:feat/on-ready-callback

Conversation

@goooseman
Copy link
Contributor

Adds a special --onReady flag.

Measure time not until the first render, but until onReady callback is not invoked from the component. Useful when you have something happening inside your component after the initial render. If enabled, a special onReady function is passed to the component as a prop, which can be called after the component has done all the initial tasks, for example:

// Your component

const FooComponent = ({ onReady }) => {
  useEffect(() => {
    doSomeHeavyCalculations().finally(() => onReady())
  }, [])
  return ()
}

@goooseman
Copy link
Contributor Author

Tests are failing nevertheless they pass locally, will check tomorrow

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

Successfully merging this pull request may close these issues.

1 participant