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
Hello! I did a personal deep dive on Stimulus yesterday and I'm really liking it.
FWIW, it appears that removing and re-adding the data-controller attribute on an existing element did not cause the connect and disconnect methods to be called. Am I missing anything here?
Hello! I did a personal deep dive on Stimulus yesterday and I'm really liking it.
FWIW, it appears that removing and re-adding the
data-controller
attribute on an existing element did not cause theconnect
anddisconnect
methods to be called. Am I missing anything here?The docs say this should be among the reasons for
disconnect()
to be called, i.e. "the element’s data-controller attribute is removed or modified".I started with the Glitch demo and defined
connect()
anddisconnect()
inhello_controller.js
:I added the following body to
index.html
:I added the following to
index.js
to trigger the change (delete and re-add) on thedata-controller
attribute:In the console I see "Hello!" when the script first loads, but I don't see it when I click the "Replace controller" button like I would expect.
Here's the Glitch link if it helps:
https://glitch.com/edit/#!/zealous-vole-1?path=src/index.js:13:0
Thanks!
The text was updated successfully, but these errors were encountered: