Skip to content

Commit

Permalink
fix(home/profile): reset mutation after changing slug
Browse files Browse the repository at this point in the history
  • Loading branch information
olexh committed May 6, 2024
1 parent 4c709a6 commit 56aff9d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/(pages)/(root)/components/profile.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';

import * as React from 'react';
import { useState } from 'react';
import { useEffect, useState } from 'react';
import MaterialSymbolsAddRounded from '~icons/material-symbols/add-rounded';
import MaterialSymbolsRemoveRounded from '~icons/material-symbols/remove-rounded';
import MaterialSymbolsSettingsOutline from '~icons/material-symbols/settings-outline';
Expand Down Expand Up @@ -44,7 +44,7 @@ const Profile = () => {
const selectedWatch =
list?.find((item) => item.anime.slug === selectedSlug) || list?.[0];

const { mutate: mutateAddWatch, variables, isPending } = useAddWatch();
const { mutate: mutateAddWatch, variables, isPending, reset } = useAddWatch();

const openWatchEditModal = () => {
if (selectedWatch) {
Expand Down Expand Up @@ -91,6 +91,10 @@ const Profile = () => {
}
};

useEffect(() => {
reset();
}, [selectedSlug]);

return (
<Block>
<Header title="Профіль" href={`/u/${loggedUser?.username}`} />
Expand Down

0 comments on commit 56aff9d

Please sign in to comment.