Make React Spring respect animation preferences (#35018)

This commit is contained in:
Echo 2025-06-11 18:51:55 +02:00 committed by GitHub
commit 3aed93711c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 14 additions and 30 deletions

View file

@ -1,8 +1,10 @@
import { createRoot } from 'react-dom/client';
import { Globals } from '@react-spring/web';
import { setupBrowserNotifications } from 'mastodon/actions/notifications';
import Mastodon from 'mastodon/containers/mastodon';
import { me } from 'mastodon/initial_state';
import { me, reduceMotion } from 'mastodon/initial_state';
import * as perf from 'mastodon/performance';
import ready from 'mastodon/ready';
import { store } from 'mastodon/store';
@ -21,6 +23,12 @@ function main() {
mountNode.getAttribute('data-props') ?? '{}',
) as Record<string, unknown>;
if (reduceMotion) {
Globals.assign({
skipAnimation: true,
});
}
const root = createRoot(mountNode);
root.render(<Mastodon {...props} />);
store.dispatch(setupBrowserNotifications());