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
in the custom methods documentation the event longpress returns {destroy} but the generated code in the REPL has longpress_handler.teardown() called in the destroy method. The longpress event would never get removed.
From #365 I understand component.destroy() is the retained convention and I am assuming the documentation is correct but the generated code is not?
(sorry if I am raising this as an issue instead of a PR but I am still trying to figure out the vision and conventions)
The text was updated successfully, but these errors were encountered:
I believe this is a docs issue, not a codegen issue. After teardown was renamed to destroy for components, the docs were updated (link), but the update was overenthusiastic in scope, as teardown was still used for custom event definitions (link), but I guess not all of the mistakes were caught.
That said, I'm not sure why custom event handlers do still use teardown. Because they're seen as something conceptually different than destroying a component? Or because of the technical difficulty of deprecating teardown while still keeping old code working? Either way, this also seems ripe for a runtime dev: true check and warning.
Yeah, I think we should rename it to destroy, but for now the docs are just wrong. Have just pushed a fix. Will leave this open so that we can address the underlying issue. It'd be nice to deprecate this gracefully — remove teardown in v2, but support both until then with a dev warning.
For event handlers that are declared inline, like the one in the docs example, we could catch it at compile time in most cases.
in the custom methods documentation the event
longpress
returns{destroy}
but the generated code in the REPL haslongpress_handler.teardown()
called in the destroy method. The longpress event would never get removed.From #365 I understand
component.destroy()
is the retained convention and I am assuming the documentation is correct but the generated code is not?(sorry if I am raising this as an issue instead of a PR but I am still trying to figure out the vision and conventions)
The text was updated successfully, but these errors were encountered: