]> cat aescling's git repositories - mastodon.git/commitdiff
Fix swiping columns on mobile sometimes failing (#11200)
authorThibG <thib@sitedethib.com>
Fri, 28 Jun 2019 11:52:15 +0000 (13:52 +0200)
committerEugen Rochko <eugen@zeonfederated.com>
Fri, 28 Jun 2019 11:52:15 +0000 (13:52 +0200)
Fixes #9779

app/javascript/mastodon/features/ui/components/columns_area.js

index 756db3c61ad825f0994e61cbcb26f121501c3a05..042e44e43e9f46cb42518941a7544a25b41688bb 100644 (file)
@@ -110,6 +110,11 @@ class ColumnsArea extends ImmutablePureComponent {
     // React-router does this for us, but too late, feeling laggy.
     document.querySelector(currentLinkSelector).classList.remove('active');
     document.querySelector(nextLinkSelector).classList.add('active');
+
+    if (!this.state.shouldAnimate && typeof this.pendingIndex === 'number') {
+      this.context.router.history.push(getLink(this.pendingIndex));
+      this.pendingIndex = null;
+    }
   }
 
   handleAnimationEnd = () => {
@@ -160,7 +165,6 @@ class ColumnsArea extends ImmutablePureComponent {
     const { shouldAnimate } = this.state;
 
     const columnIndex = getIndex(this.context.router.history.location.pathname);
-    this.pendingIndex = null;
 
     if (singleColumn) {
       const floatingActionButton = shouldHideFAB(this.context.router.history.location.pathname) ? null : <Link key='floating-action-button' to='/statuses/new' className='floating-action-button' aria-label={intl.formatMessage(messages.publish)}><Icon id='pencil' /></Link>;