Skip to content

Events on custom components no longer fire after changing frames #344

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lsapan opened this issue Oct 9, 2018 · 3 comments
Closed

Events on custom components no longer fire after changing frames #344

lsapan opened this issue Oct 9, 2018 · 3 comments
Labels
priority:normal V2 Issues related to V2

Comments

@lsapan
Copy link

lsapan commented Oct 9, 2018

Version

2.0.2

Reproduction link

https://play.nativescript.org/?template=play-vue&id=PTvaZr&v=3

Platform and OS info

iOS 12 / NativeScript 5 (and presumably 4 in Playground) / macOS Mojave

Steps to reproduce

This issue started after the fix for #339 was rolled out in 2.0.1/2.0.2. As such, the Playground link above will not replicate this bug because it's using 2.0.0. I've tested the repro code locally with 2.0.2 and it experiences the issue.

This app utilizes multiple frames to allow a custom "tab bar". It's a pretty simple tab bar implementation, each tab get its own frame so they can navigate independently, and tabs are lazily loaded.

After 2.01/2.0.2 (not sure specifically which), the first button on Step 1 will stop working if you tab back over to the first tab, and back to the second.

Step 1 is listening for the first button's custom @tap event, while it's listening for the second one's native @tap event, hence the difference.

What is expected?

Both buttons should continue to work.

What is actually happening?

The custom component's event is not fired / handled.


It was pretty difficult to figure out what exactly the issue was, but I was finally able to minimize the test case as much as I could. Let me know if you need any additional information or clarification!

(Also thank you for fixing #339 so promptly!)

Update: To clarify, the @tap event is firing on the custom button's button. It's the parent component that is not responding to the $emit. As such, this affects any custom $emit, not just taps.

rigor789 added a commit that referenced this issue Oct 10, 2018
@rigor789
Copy link
Member

This is a tricky one, because <keep-alive> will keep the frames alive, but frame navigation and the component that is navigated to does not live under the element (this is something I want to change soon). For this use-case, I would suggest using v-show on the Frames and ditching <keep-alive>, as the two don't work well together. While this is a bug, I consider it an edge case for now, but will definitely try to get this setup working when I refactor the frame and the navigation a little bit.

@lsapan
Copy link
Author

lsapan commented Oct 10, 2018

@rigor789 yeah it's definitely an edge case. The only downside to v-show is the lack of lazy-loading tabs, but there are always workarounds haha.

On a semi-related note, I noticed that the activated and deactivated lifecycle hooks don't fire on Frame descendants, but that's purely just because the component isn't actually a child of the Frame component right? Sounds like the refactoring will actually take care of both. Looking forward to it! 👍

@rigor789
Copy link
Member

rigor789 commented Oct 10, 2018

@lsapan Yes the deactivated/activated hooks don't fire because they pages are not actually child elements. Unfortunately it's not so simple to make them actual childs, as it causes side effects (aka the app crashes :D )

@rigor789 rigor789 added the V2 Issues related to V2 label Dec 5, 2022
@rigor789 rigor789 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority:normal V2 Issues related to V2
Development

No branches or pull requests

3 participants