Custom Reveals seem not to work anymore since version beta-0.6.3
Closed this issue · 5 comments
After upgrading from beta-0.6.1 to beta-0.6.3 the following code caused an error saying TypeError: Cannot read properties of undefined (reading 'in')
:
luge.reveal.add('in', 'triggerNav', updateNav)
This did work before. I'm calling it inside a React.useEffect function, that depends on the luge
object. Is it more proper to call it in a lifecycle listener à la luge.lifecycle.add('pageInit', () => registerMyCustomReveals(luge))
?
Just realised that this works as intended (I forgot to call done()
):
function registerMyCustomReveals(luge) {
luge.reveal.add('in', 'triggerNav',() => { ... });
}
... loading luge ...
React.useEffect( () => {
luge.lifecycle.add('pageInit', (done) => {
registerMyCustomReveals(luge)
done()
})
}, [luge])
Means that I better wait for the lifecycle call, correct?
It's a bug that I have to fix, I'm working on a new version.
But for now it's ok to add your reveals from a lifecycle hook, the siteInit
one should do the job.
It works!