From fc2931855e1a67742f3ad0ec62900dfae3f5b2ed Mon Sep 17 00:00:00 2001 From: Sai K K Date: Mon, 4 Nov 2024 21:08:31 +0530 Subject: [PATCH] feat: adds save preferences on collections --- .../bruno-app/src/components/Sidebar/Collections/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/bruno-app/src/components/Sidebar/Collections/index.js b/packages/bruno-app/src/components/Sidebar/Collections/index.js index 91018594f..fb59150be 100644 --- a/packages/bruno-app/src/components/Sidebar/Collections/index.js +++ b/packages/bruno-app/src/components/Sidebar/Collections/index.js @@ -1,5 +1,6 @@ import React, { useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; +import { savePreferences } from 'providers/ReduxStore/slices/app'; import { IconSearch, IconFolders, @@ -22,6 +23,8 @@ const CollectionsBadge = () => { const dispatch = useDispatch(); const { collections } = useSelector((state) => state.collections); const { collectionSortOrder } = useSelector((state) => state.collections); + const preferences = useSelector((state) => state.app.preferences); + const sortCollectionOrder = () => { let order; switch (collectionSortOrder) { @@ -36,6 +39,10 @@ const CollectionsBadge = () => { break; } dispatch(sortCollections({ order })); + dispatch(savePreferences({ + ...preferences, + collectionSortOrder: order + })); }; return (