about summary refs log tree commit diff
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-06-28 13:52:15 +0200
committermultiple creatures <dev@multiple-creature.party>2020-02-22 01:48:18 -0600
commit93ffd33eb34f9a0bc9173053ab7391f5c533a81c (patch)
treea7e6b28c2f37c6cf08a2b672cf7b70eab39386a2
parent8a516e61a382d3ceb88e84b9bcdc2f84045cf4d9 (diff)
[Glitch] Fix swiping columns on mobile sometimes failing
Port 072158ee973f8e09a0abd34a825d9bce038a5d68 to glitch-soc
-rw-r--r--app/javascript/flavours/glitch/features/ui/components/columns_area.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/features/ui/components/columns_area.js b/app/javascript/flavours/glitch/features/ui/components/columns_area.js
index 12aa396fd..85b8f36a7 100644
--- a/app/javascript/flavours/glitch/features/ui/components/columns_area.js
+++ b/app/javascript/flavours/glitch/features/ui/components/columns_area.js
@@ -112,6 +112,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 = () => {
@@ -162,7 +167,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)}><i className='fa fa-pencil' /></Link>;