Skip to content
This repository was archived by the owner on Feb 12, 2025. It is now read-only.

Commit 1968860

Browse files
fix: update key for usePlan
1 parent c484e77 commit 1968860

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/config/keys.ts

+8-5
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,13 @@ export const buildItemInvitationsKey = (id?: UUID) => [
135135
'invitations',
136136
];
137137

138+
export const PLANS_KEY = 'plans';
139+
export const OWN_PLAN_KEY = 'ownPlan';
140+
export const buildPlanKey = (id: string) => [MEMBERS_KEY, id, 'plans'];
141+
export const buildPlansKey = (id: string) => [MEMBERS_KEY, id, 'plans'];
142+
export const CARDS_KEY = 'cards';
143+
export const CURRENT_CUSTOMER_KEY = 'currentCustomer';
144+
138145
export const DATA_KEYS = {
139146
APPS_KEY,
140147
ITEMS_KEY,
@@ -182,12 +189,8 @@ export const DATA_KEYS = {
182189
buildItemValidationGroupsKey,
183190
buildInvitationKey,
184191
buildItemInvitationsKey,
192+
buildPlanKey,
185193
};
186-
export const PLANS_KEY = 'plans';
187-
export const OWN_PLAN_KEY = 'ownPlan';
188-
export const buildPlansKey = (id: string) => [MEMBERS_KEY, id, 'plans'];
189-
export const CARDS_KEY = 'cards';
190-
export const CURRENT_CUSTOMER_KEY = 'currentCustomer';
191194

192195
export const MUTATION_KEYS = {
193196
POST_ITEM: 'postItem',

src/hooks/plan.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Map, List } from 'immutable';
33
import { QueryClientConfig } from '../types';
44
import * as Api from '../api';
55
import {
6+
buildPlanKey,
67
CARDS_KEY,
78
CURRENT_CUSTOMER_KEY,
89
OWN_PLAN_KEY,
@@ -19,7 +20,7 @@ export default (queryConfig: QueryClientConfig) => {
1920

2021
const usePlan = ({ planId }: { planId: string }) =>
2122
useQuery({
22-
queryKey: PLANS_KEY,
23+
queryKey: buildPlanKey(planId),
2324
queryFn: () =>
2425
Api.getPlan({ planId }, queryConfig).then((data) => Map(data)),
2526
...defaultOptions,

0 commit comments

Comments
 (0)