Fix event handler removal on disconnect #540
Reference in New Issue
Block a user
Delete Branch "fix-removeeventhandler-disconnect"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Calling
.bind(this)always returns a new function, meaning that event handlers registered inconnectcallbacks were never properly removed indisconnectcallbacks. Creating event handlers as arrow functions fixed this and also makes the code simpler.The code does look nicer, but this introduces some bugs, likely related to Turbo as shown in the video below. In order for tab content to show, a full browser refresh is required:
https://github.com/maybe-finance/maybe/assets/16676157/55c9aa27-74db-4ba9-ba7d-2a36201dcc19
@zachgoll Well spotted! I have pushed a fix, the issue was that the
updateClassesmethod intab-controllerwas receiving the turbo event as the first argument (but it expected the tab to select).@jakubkottnauer awesome, looks good now!