From 8d2d3e62cd5283eeadce8d32b2ef4dda280f7f26 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Mon, 11 Dec 2017 17:30:10 +0000 Subject: [PATCH] Only commit a non-falsy tags list --- src/actions/TagOrderActions.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/actions/TagOrderActions.js b/src/actions/TagOrderActions.js index d98cf28ca8..76d48bff99 100644 --- a/src/actions/TagOrderActions.js +++ b/src/actions/TagOrderActions.js @@ -23,10 +23,14 @@ const TagOrderActions = {}; TagOrderActions.commitTagOrdering = createPromiseActionCreator( 'TagOrderActions.commitTagOrdering', (matrixClient) => { + // Only commit tags if the state is ready, i.e. not null + const tags = TagOrderStore.getOrderedTags(); + if (!tags) { + return; + } + Analytics.trackEvent('TagOrderActions', 'commitTagOrdering'); - return matrixClient.setAccountData('im.vector.web.tag_ordering', { - tags: TagOrderStore.getOrderedTags(), - }); + return matrixClient.setAccountData('im.vector.web.tag_ordering', {tags}); }, );