Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(frontend): refesh count after nlp sample import #198

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions frontend/src/components/nlp/NlpImportDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export const NlpImportDialog: FC<NlpImportDialogProps> = ({
mutationFn: async (attachmentId: string | null) => {
attachmentId && (await apiClient.importNlpSamples(attachmentId));
},
onSuccess: () => {
queryClient.removeQueries({
onSuccess: async () => {
await queryClient.invalidateQueries({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should remove the queries, cause it will still fetch invalidated queries. Or maybe I'm missing something.

Copy link
Contributor Author

@yassinedorbozgithub yassinedorbozgithub Oct 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When i test it with removeQueries the selected queries are removed without triggering a refreshing to update the counts counters but if we invalidate the queries selected, this action will force them to re-fetch and this will update the UI count numbers

predicate: ({ queryKey }) => {
const [qType, qEntity] = queryKey;

Expand Down