Skip to content
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

Directive destroyed before animation end #408

Closed
ar53n opened this issue Aug 8, 2018 · 12 comments
Closed

Directive destroyed before animation end #408

ar53n opened this issue Aug 8, 2018 · 12 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@ar53n
Copy link

ar53n commented Aug 8, 2018

vue & vue-i18n version

ex: 2.5.16, 8.0

Reproduction Link

Steps to reproduce

hide_directive

What is Expected?

When using non-directive way its work correctly.

What is actually happening?

@kimuraz
Copy link
Contributor

kimuraz commented Aug 9, 2018

Can you add a reproduction link?

I couldn't reproduce it: Codepen

@ar53n
Copy link
Author

ar53n commented Aug 9, 2018

@kimuraz https://codepen.io/anon/pen/ejQqvp. Thank you for reproduce link. Just i changed v-show to v-if. But in my project used router-view.

@kimuraz
Copy link
Contributor

kimuraz commented Aug 17, 2018

@ar53n I guess that this issues is due to which order the directives are resolved in VueJS transitions (see this). Since it seems to be async because of the timeout, while it doesn't resolves, the v-t directive resolves with v-if / v-show. Although I'm not sure, let me know if you go on solving this problems.

@connected
Copy link

connected commented Oct 5, 2018

It was not an issue for version 7.8.0, see https://codepen.io/madhamster/pen/ReRxBL
Possible solution is to lock version in package.json

IMO this is def. a plugin bug, not vue.

@thariddler
Copy link

I have the same issue! Locking version is not the solution! Very frustrating that it's literally broke whole page transitions in my app.

bponomarenko added a commit to bponomarenko/vue-i18n that referenced this issue Dec 28, 2018
bponomarenko added a commit to bponomarenko/vue-i18n that referenced this issue Dec 29, 2018
@bponomarenko
Copy link
Contributor

I have added PR #495 which suppose to fix this issue. @ar53n @connected @thariddler will this work for you?

@kazupon kazupon added Type: Bug Bug or Bug fixes help wanted Extra attention is needed good first issue Good for newcomers improvement and removed Type: Bug Bug or Bug fixes labels Jan 2, 2019
@kazupon kazupon closed this as completed in c29edba Jan 2, 2019
@rchl
Copy link
Contributor

rchl commented Feb 12, 2019

I've just noticed this problem and then found the solution that works for me, but I do wonder about the downsides of using the solution (using global preserveDirectiveContent setting). Nowhere in the documentation I can find any mention of cons so I wonder why it's not enabled by default.

I have noticed this problem with Nuxt and without even using transitions. Just clicking a nuxt-link (router-link) causes text to disappear from page before navigating to new page. I believe it's either due to asyncData or nuxt-i18n locale handling but either way, the question is why is that not enabled by default?

@rchl
Copy link
Contributor

rchl commented Feb 25, 2019

@kazupon any comments?

@kazupon
Copy link
Owner

kazupon commented Feb 26, 2019

@rchl
It's backward compatibility.

@bponomarenko said in #495

preserveDirectiveContent is false by default to remain backward compatibility. In the future (if there will be demand for it) it can be set to true by default, but that would be a breaking change.

@rchl
Copy link
Contributor

rchl commented Feb 26, 2019

It doesn't really answer my question.
What exactly does/can it break?
Is it just to be on the safe side, because the behaviour is slightly different?
Any specific issues are to be expected @bponomarenko?

@bponomarenko
Copy link
Contributor

bponomarenko commented Feb 26, 2019

@rchl Hi Rafał

I would consider this change to be a "breaking change" because it changes functionality of the library – after v-t directive destroy content will be preserved instead of cleaned up. It may not break someones project, but can result in unexpected behaviour if that project, let say, has some logic around presence of the content inside text blocks. How rationale this logic is is another discussion but, in my experience, sometimes developers can just implement hacks for a solution to work.

Taking this into consideration, and general best practices for packages versioning, it would require to bump major library version in order to enable preserveDirectiveContent feature by default. I didn't do that in my PR because major releases usually take more time to publish, as they tend to aggregate multiple breaking changes. However, to be able to use this functionality faster – I added this feature turned off by default (preserving original library behaviour), so only minor version bump were required.

If you really need this feature to be turned on by default, I believe the best would be creating different issue specific to this request. Which can be satisfied in the next major update, but that is up to the library author.

I hope this clarifies it a bit.

@rchl
Copy link
Contributor

rchl commented Feb 26, 2019

Yes, that is more or less what I've expected to hear.

I can enable it myself so I'm fine here but I agree that it should be on the roadmap for enabling on next major version as otherwise basic functionality of Vue breaks.
And for Nuxt it also makes for some ugly visual behaviour in some cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

7 participants