Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
refactor: store changes for collections (#2947)
Akash K1372681b8768
diff --git a/packages/hoppscotch-common/src/newstore/collections.ts b/packages/hoppscotch-common/src/newstore/collections.tsindex 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 defaultRESTCollectionStatetype GraphqlCollectionStoreType = typeof defaultGraphqlCollectionState-function navigateToFolderWithIndexPath(+export function navigateToFolderWithIndexPath(collections: HoppCollection<HoppRESTRequest | HoppGQLRequest>[],indexPaths: number[]) {@@ -97,12 +97,15 @@ const restCollectionDispatchers = defineDispatchers({{ state }: RESTCollectionStoreType,{collectionIndex,- collection,- }: { collectionIndex: number; collection: HoppCollection<any> }+ partialCollection,+ }: {+ collectionIndex: number+ partialCollection: Partial<HoppCollection<any>>+ }) {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<HoppRESTRequest>+ partialCollection: Partial<HoppCollection<HoppRESTRequest>>) {restCollectionStore.dispatch({dispatcher: "editCollection",payload: {collectionIndex,- collection,+ partialCollection: partialCollection,},})}