diff --git a/ui/constants/action_types.js b/ui/constants/action_types.js
index 8cc077d48..d9050aac7 100644
--- a/ui/constants/action_types.js
+++ b/ui/constants/action_types.js
@@ -195,6 +195,7 @@ export const COLLECTION_ITEMS_RESOLVE_STARTED = 'COLLECTION_ITEMS_RESOLVE_STARTE
export const COLLECTION_ITEMS_RESOLVE_COMPLETED = 'COLLECTION_ITEMS_RESOLVE_COMPLETED';
export const COLLECTION_ITEMS_RESOLVE_FAILED = 'COLLECTION_ITEMS_RESOLVE_FAILED';
export const COLLECTION_NEW = 'COLLECTION_NEW';
+export const COLLECTION_RENAME = 'COLLECTION_RENAME';
export const COLLECTION_DELETE = 'COLLECTION_DELETE';
export const COLLECTION_PENDING = 'COLLECTION_PENDING';
export const COLLECTION_EDIT = 'COLLECTION_EDIT';
diff --git a/ui/redux/actions/collections.js b/ui/redux/actions/collections.js
index d2530bcab..374afe632 100644
--- a/ui/redux/actions/collections.js
+++ b/ui/redux/actions/collections.js
@@ -40,6 +40,14 @@ export const doLocalCollectionCreate = (
});
};
+export const doCollectionRename = (id: string, newName: string) => ({
+ type: ACTIONS.COLLECTION_RENAME,
+ data: {
+ id,
+ newName,
+ },
+});
+
export const doCollectionDelete = (id: string, colKey: ?string = undefined) => (
dispatch: Dispatch,
getState: GetState
diff --git a/ui/redux/reducers/collections.js b/ui/redux/reducers/collections.js
index 2cd0fb96d..f2b1e1fb5 100644
--- a/ui/redux/reducers/collections.js
+++ b/ui/redux/reducers/collections.js
@@ -58,6 +58,19 @@ const collectionsReducer = handleActions(
};
},
+ [ACTIONS.COLLECTION_RENAME]: (state, action) => {
+ const { unpublished } = state;
+ const { id, newName } = action.data;
+ const newUnpublished = { ...unpublished };
+ if (newUnpublished[id]) {
+ newUnpublished[id].name = newName;
+ }
+ return {
+ ...state,
+ unpublished: newUnpublished,
+ };
+ },
+
[ACTIONS.COLLECTION_DELETE]: (state, action) => {
const { lastUsedCollection } = state;
const { id, collectionKey } = action.data;