From 7d665f3933f981e447a77836dfc95e660662ece0 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 16 Sep 2018 12:48:28 +0200 Subject: [PATCH] Ensured tags returned from server are used after editing short URL tags in order to use the normalized values --- src/short-urls/helpers/EditTagsModal.js | 4 ++-- src/short-urls/reducers/shortUrlTags.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/short-urls/helpers/EditTagsModal.js b/src/short-urls/helpers/EditTagsModal.js index c3832bb5..83d94470 100644 --- a/src/short-urls/helpers/EditTagsModal.js +++ b/src/short-urls/helpers/EditTagsModal.js @@ -40,8 +40,8 @@ export class EditTagsModalComponent extends React.Component { return; } - const { shortUrlTagsEdited, shortUrl } = this.props; - const { tags } = this.state; + const { shortUrlTagsEdited, shortUrl, shortUrlTags } = this.props; + const { tags } = shortUrlTags; shortUrlTagsEdited(shortUrl.shortCode, tags); }; diff --git a/src/short-urls/reducers/shortUrlTags.js b/src/short-urls/reducers/shortUrlTags.js index a24fb7ee..597c5a89 100644 --- a/src/short-urls/reducers/shortUrlTags.js +++ b/src/short-urls/reducers/shortUrlTags.js @@ -56,9 +56,9 @@ export const _editShortUrlTags = (shlinkApiClient, shortCode, tags) => async (di dispatch({ type: EDIT_SHORT_URL_TAGS_START }); try { - // Update short URL tags - await shlinkApiClient.updateShortUrlTags(shortCode, tags); - dispatch({ tags, shortCode, type: EDIT_SHORT_URL_TAGS }); + const normalizedTags = await shlinkApiClient.updateShortUrlTags(shortCode, tags); + + dispatch({ tags: normalizedTags, shortCode, type: EDIT_SHORT_URL_TAGS }); } catch (e) { dispatch({ type: EDIT_SHORT_URL_TAGS_ERROR });