diff --git a/packages/hoppscotch-common/src/newstore/collections.ts b/packages/hoppscotch-common/src/newstore/collections.ts index 0068e24db..39c3e0c91 100644 --- a/packages/hoppscotch-common/src/newstore/collections.ts +++ b/packages/hoppscotch-common/src/newstore/collections.ts @@ -31,7 +31,7 @@ const defaultGraphqlCollectionState = { type RESTCollectionStoreType = typeof defaultRESTCollectionState type GraphqlCollectionStoreType = typeof defaultGraphqlCollectionState -function navigateToFolderWithIndexPath( +export function navigateToFolderWithIndexPath( collections: HoppCollection[], indexPaths: number[] ) { @@ -97,12 +97,15 @@ const restCollectionDispatchers = defineDispatchers({ { state }: RESTCollectionStoreType, { collectionIndex, - collection, - }: { collectionIndex: number; collection: HoppCollection } + partialCollection, + }: { + collectionIndex: number + partialCollection: Partial> + } ) { return { state: state.map((col, index) => - index === collectionIndex ? collection : col + index === collectionIndex ? { ...col, ...partialCollection } : col ), } }, @@ -824,13 +827,13 @@ export function getRESTCollection(collectionIndex: number) { export function editRESTCollection( collectionIndex: number, - collection: HoppCollection + partialCollection: Partial> ) { restCollectionStore.dispatch({ dispatcher: "editCollection", payload: { collectionIndex, - collection, + partialCollection: partialCollection, }, }) }