about summary refs log tree commit diff
path: root/app/javascript/mastodon/features/ui/util/optional_motion.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/javascript/mastodon/features/ui/util/optional_motion.js')
-rw-r--r--app/javascript/mastodon/features/ui/util/optional_motion.js9
1 files changed, 1 insertions, 8 deletions
diff --git a/app/javascript/mastodon/features/ui/util/optional_motion.js b/app/javascript/mastodon/features/ui/util/optional_motion.js
index af6368738..82edbbe8f 100644
--- a/app/javascript/mastodon/features/ui/util/optional_motion.js
+++ b/app/javascript/mastodon/features/ui/util/optional_motion.js
@@ -4,11 +4,10 @@
 import React from 'react';
 import Motion from 'react-motion/lib/Motion';
 import PropTypes from 'prop-types';
+import { reduceMotion } from '../../../initial_state';
 
 const stylesToKeep = ['opacity', 'backgroundOpacity'];
 
-let reduceMotion;
-
 const extractValue = (value) => {
   // This is either an object with a "val" property or it's a number
   return (typeof value === 'object' && value && 'val' in value) ? value.val : value;
@@ -26,12 +25,6 @@ class OptionalMotion extends React.Component {
 
     const { style, defaultStyle, children } = this.props;
 
-    if (typeof reduceMotion !== 'boolean') {
-      // This never changes without a page reload, so we can just grab it
-      // once from the body classes as opposed to using Redux's connect(),
-      // which would unnecessarily update every state change
-      reduceMotion = document.body.classList.contains('reduce-motion');
-    }
     if (reduceMotion) {
       Object.keys(style).forEach(key => {
         if (stylesToKeep.includes(key)) {