You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tested to implement useTransition with Turbo drive (SPA naviguation).
And it doesn't disconnect properly:
import{Controller}from'@hotwired/stimulus';import{useTransition}from'stimulus-use';exportdefaultclassextendsController{statictargets=['menu']initialize(){useTransition(this,{element: this.menuTarget,enterActive: 'fade-enter-active',enterFrom: 'fade-enter-from',enterTo: 'fade-enter-to',leaveActive: 'fade-leave-active',leaveFrom: 'fade-leave-from',leaveTo: 'fade-leave-to',hiddenClass: 'hidden',// set this, because the item *starts* in an open statetransitioned: false,});}disconnect(){this.leave();}closeMenu(){this.leave();}openMenu(){this.enter();}toggleMenu(){this.toggleTransition();}}
Each time I naviguate between page, it will register multiple instance of this controller and events are trigger multiple times (which will cause issue and memory leaks).
Thank in advance
The text was updated successfully, but these errors were encountered:
marcoroth
changed the title
Turbo drive - cannot properly disconnectuseTransition: Turbo drive - cannot properly disconnect
Nov 26, 2023
Hello,
I tested to implement useTransition with Turbo drive (SPA naviguation).
And it doesn't disconnect properly:
Each time I naviguate between page, it will register multiple instance of this controller and events are trigger multiple times (which will cause issue and memory leaks).
Thank in advance
The text was updated successfully, but these errors were encountered: