Skip to content

Commit

Permalink
fix(editpage): change query key from object to array (#1623)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcshzj authored Oct 26, 2023
1 parent 16f6acc commit 7f144ee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/hooks/pageHooks/useGetPageHook.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ import { DEFAULT_RETRY_MSG } from "utils"
export function useGetPageHook(params, queryParams) {
const { pageService } = useContext(ServicesContext)
const errorToast = useErrorToast()
const { siteName, fileName } = params

return useQuery(
[PAGE_CONTENT_KEY, { ...params }],
[PAGE_CONTENT_KEY, siteName, fileName],
() => pageService.get(params),
{
...queryParams,
Expand Down
4 changes: 3 additions & 1 deletion src/hooks/pageHooks/useUpdatePageHook.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export function useUpdatePageHook(params, queryParams) {
const { pageService } = useContext(ServicesContext)
const successToast = useSuccessToast()
const errorToast = useErrorToast()
const { siteName, fileName } = params

return useMutation(
(body) => {
const { newFileName, sha, frontMatter, pageBody } = extractPageInfo(body)
Expand All @@ -33,7 +35,7 @@ export function useUpdatePageHook(params, queryParams) {
{
...queryParams,
onSettled: () => {
queryClient.invalidateQueries([PAGE_CONTENT_KEY, { ...params }])
queryClient.invalidateQueries([PAGE_CONTENT_KEY, siteName, fileName])
},
onSuccess: () => {
if (params.collectionName)
Expand Down

0 comments on commit 7f144ee

Please sign in to comment.