V3.2.0 js.foresight
In this update we changed the lifecycle of an registered element. Nothing will change for most applications but it is nice to know.
Before:
Register → callback hit → unregister
Now:
Register → callback hit → isCallbackActive prop set to false → wait for reactivateAfter ms (default infinitely) → set isCallbackActive back to true → Go back to callback hit step
With this new lifecycle it is now possible to refetch again after reactivateAfter ms, this is usefull for when you know your data that you prefetched earlier is stale. You can also programmatically reset isCallbackActive by calling ForesightManager.instance.reactivate().
Elements will still automatically be unregistered on DOM removal
Changes
ForesightManager.instance.unregister()is now a public API for unregistering elementsunregister()as return fromForesightManager.instance.register()has been deprecated
Features
- added
elementReactivatedEventwhich emits after an element is reactivated (ifisCallbackActiveis true) - added
callbackInfotoForesightElementDatawith the following props for debugging purposes:callbackFiredCountlastCallbackInvokedAtlastCallbackCompletedAtlastCallbackRuntimelastCallbackStatuslastCallbackErrorMessagereactivateAfterisCallbackActiveisRunningCallback
V1.1.0 js.foresight-devtools
Features
- Element tab now distinguishes between active/unactive elements
- Element tab shows countdown of when the callback will be reactivated by setting
isCallbackActiveto true. Which isreactivateAfterms after the callback is completed not invoked. - Element tab allows you to unregister an element by clicking the trash icon
- Log tab now has the
elementReactivatedEvent - Both the json in the logs and element tab now show the full
callbackInfofromForesightElementData
All updates can be viewed in the Playground