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

Remove auto will-change #2824

Merged
merged 3 commits into from
Oct 15, 2024
Merged

Remove auto will-change #2824

merged 3 commits into from
Oct 15, 2024

Conversation

mattgperry
Copy link
Collaborator

Fixes #2816
Fixes #2763

Auto will-change was an attempt at semi-intelligently applying will-change for the right values when animations trigger.

Due to various rendering issues (the above tickets, #2818 (comment) and things we've seen in Framer) I think the safer thing to do is to remove this and leave it to users.

This PR removes auto will-change but allows users to opt-in as before via useWillChange.

@robmeede
Copy link

Any chance this PR will be part of a release soon?

@mattgperry
Copy link
Collaborator Author

mattgperry commented Oct 15, 2024

@robmeede Probably today or tomorrow but you can already override with style={{ willChange: "auto" }}

@ynamite
Copy link

ynamite commented Oct 15, 2024

@mattgperry this fix doesn't work with useAnimate (or rather animate) though, right? Is there a similar fix? Right now I'm setting will-change manually after a setTimeout. Fugly, but it works :)

Out of curiosity, how big of a performance impact does will-change have or what was the rationale behind adding auto will-change?

@mattgperry
Copy link
Collaborator Author

@ynamite That's right actually, you'd either have to pass it through as an animated value or change the element to a motion component. But yeah this will be fixed in the next release.

Interested in what was breaking for you with it?

Ideally this would be something I could take off people's plates. As the performance benefit can differ between Safari/Chrome/devices. And making too many layers can be detrimental.

I'm removing it now actually because users are reporting various problems with it, but then manually adding it back in Framer because we're seeing performance improvements, especially during scroll, when its added.

Personally I don't believe the measured performance benefits are that great but the perception was that framer.com was smoother with it and sometimes that's more important. But my feeling now is I can't automate it in a way that's useful for a broad range of people, hence this PR.

@mattgperry mattgperry added the automerge Land this PR label Oct 15, 2024
@mattgperry mattgperry merged commit a2b81ac into main Oct 15, 2024
1 check passed
@mattgperry mattgperry deleted the fix/revert-will-change branch October 15, 2024 08:23
@mergetron mergetron bot removed the autorebasing label Oct 15, 2024
@ynamite
Copy link

ynamite commented Oct 15, 2024

Ah I see, thanks. I believe I tried solving it as you suggest, but couldn't get it to work. But maybe I'd done something wrong.

And thanks also for the explanation. In my case I'm handling route transitions with Framer Motion. Some pages have modals (triggered after a click on a button) and these modals have position fixed. It's not a problem when the whole view is transitioned, but if it's only certain components of a view, the modals would then be positioned relative to the parent that is being transitioned (stacking context) as long as will-change is set to something other than auto.

I actually quite like the idea of auto will-change, but at the very least, it should either be configurable (default auto) to turn it off or Framer Motion would have to remove it automatically when a transition ends. Similar to how GSAPs clear: all property works. Come to think of it, something like clear: all would be awesome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Land this PR
Projects
None yet
4 participants