AntoineW/luge

Custom Reveals seem not to work anymore since version beta-0.6.3

Closed this issue · 5 comments

blzzz commented

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))?

blzzz commented

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.

@blzzz this bug should be fixed by new version 0.6.5-beta 🙏

blzzz commented

Perfect – thanks a lot, @AntoineW. I'll give it a try.

blzzz commented

It works!