-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
#4441: Improve animations and dynamically import animation libraries to reduce bundle size #4500
#4441: Improve animations and dynamically import animation libraries to reduce bundle size #4500
Conversation
…reaction into perf-4441-dancastellon-eliminate-velocity
…reaction into perf-4441-dancastellon-eliminate-velocity
@dancastellon When editing tags I see the green flash when exiting the input but not when entering |
Seeing this error when I double-click on a product logged in as an admin
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seeing a complete crash of the app when double-clicking on a product. Also it looks like we are only partially eliminating Velocity?
/** | ||
* @name composer | ||
* @private | ||
* @summary Reactive Tracker wrapped function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem like a very good description of this function
@@ -407,6 +405,7 @@ class ActionView extends Component { | |||
|
|||
renderDetailView() { | |||
const { actionView } = this.props; | |||
const { VelocityTransitionGroup } = this.state; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't understand why this is still here if we are eliminating Velocity. Do we need to just rename this?
@@ -47,6 +51,21 @@ class CardBody extends Component { | |||
} | |||
|
|||
render() { | |||
const { VelocityTransitionGroup } = this.state; | |||
if (VelocityTransitionGroup === undefined) { | |||
import("velocity-react") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why aren't eliminating this as well?
@zenweasel I originally left the The downside is that while this would let us remove |
…reaction into perf-4441-dancastellon-eliminate-velocity
…p + VelocityTransitionGroup
I vote for switching to react-transition-group and react-animate-height. They seem small and specific compared to using velocity. If you were to try to achieve the same thing, you'd essentially rebuild them. |
…reaction into perf-4441-dancastellon-eliminate-velocity
@aldeed I agree, done. react-animate-height is much smaller (7.7kb) than velocity-react (94.5kb). |
@dancastellon What's the status on this? Can we quickly make the changes that @aldeed requested? |
@zenweasel This one's ready to go. This morning I fixed a |
@dancastellon is there a specific reason you chose to go with Additionally, we're loading |
Resolves #4441
Impact: minor
Type: performance
Issue
We currently have
velocity-animate
in the client bundle at 94.5kb. We use Velocity for 5 things:Solution
Most of the animations are replaceable with CSS. Remove
velocity-animate
and replace those, using a new component calledCSSTransitionGroup
and CSS. Animating the height of admin panel cards requires JS. Use the smallreact-animate-height
library for that.Whether using CSSTransitionGroup or Animate height, the bundle size should not be affected (dynamic imports).
Note: This PR removes
velocity-animate
andvelocity-react
from package.json, and addsreact-transition-group
andreact-animate-height
- both of which are much smaller then Velocity.Breaking changes
None
Testing
velocity-animate
,velocity-react
,react-animate-height
,react-transition-group
. Run withexport TOOL_NODE_FLAGS='--max-old-space-size=4096' && METEOR_DISABLE_OPTIMISTIC_CACHING=1 meteor run --production --extra-packages bundle-visualizer
Before
After