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

fix(transition-group): not add class v-move to v-show element #7906

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

pengchongfu
Copy link
Contributor

@pengchongfu pengchongfu commented Mar 27, 2018

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information:
fix #7879

@posva
Copy link
Member

posva commented Apr 7, 2018

Hey, sorry for the delay 😅 Could you check the failing test, please?
Note: remember to close #7905 if we merge this (both are supposed to fix the same issue)

this will close #7879

@@ -77,6 +77,7 @@ export default {
for (let i = 0; i < prevChildren.length; i++) {
const c: VNode = prevChildren[i]
c.data.transition = transitionData
c.data.isDisplayNone = c.elm.style.display === 'none'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accessing element.style here in a loop will probably cause serious perf issues due to forced layouts. More info: https://developers.google.com/web/fundamentals/performance/rendering/avoid-large-complex-layouts-and-layout-thrashing
It's probably better to just check for empty rects ( { x: 0, y: 0, width: 0, height: 0, top: 0, right: 0, bottom: 0, left: 0 }) below

@@ -175,7 +176,7 @@ function applyTranslation (c: VNode) {
const newPos = c.data.newPos
const dx = oldPos.left - newPos.left
const dy = oldPos.top - newPos.top
if (dx || dy) {
if (!c.data.isDisplayNone && (dx || dy)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you can check if oldPos is empty rect by comparing every field to { x: 0, y: 0, width: 0, height: 0, top: 0, right: 0, bottom: 0, left: 0 }.

@pengchongfu pengchongfu force-pushed the fix-transition-group-display-none branch from f73b857 to 54586ca Compare April 8, 2018 10:39
@posva posva changed the title fix(transition-group): not add class v-move to v-show element, fix #7879 Mar 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants