infelipe Gomes
infelipe Gomes
WWasp
Created by infelipe Gomes on 4/15/2025 in #đŸ™‹questions
How to refresh table data after deleting a record in Wasp?
Hi, @Filip! Sure, I've defined them like so:
// #region Category queries
query getCategory {
fn: import { getCategory } from "@src/operations/category/queries",
entities: [Category]
}

query getCategories {
fn: import { getCategories } from "@src/operations/category/queries",
entities: [Category]
}
// #endregion

// #region Category actions
action createCategory {
fn: import { createCategory } from "@src/operations/category/actions",
entities: [Category]
}

action updateCategory {
fn: import { updateCategory } from "@src/operations/category/actions",
entities: [Category]
}

action deleteCategory {
fn: import { deleteCategory } from "@src/operations/category/actions",
entities: [Category]
}

action deleteCategories {
fn: import { deleteCategories } from "@src/operations/category/actions",
entities: [Category]
}
// #endregion
// #region Category queries
query getCategory {
fn: import { getCategory } from "@src/operations/category/queries",
entities: [Category]
}

query getCategories {
fn: import { getCategories } from "@src/operations/category/queries",
entities: [Category]
}
// #endregion

// #region Category actions
action createCategory {
fn: import { createCategory } from "@src/operations/category/actions",
entities: [Category]
}

action updateCategory {
fn: import { updateCategory } from "@src/operations/category/actions",
entities: [Category]
}

action deleteCategory {
fn: import { deleteCategory } from "@src/operations/category/actions",
entities: [Category]
}

action deleteCategories {
fn: import { deleteCategories } from "@src/operations/category/actions",
entities: [Category]
}
// #endregion
18 replies
WWasp
Created by infelipe Gomes on 4/15/2025 in #đŸ™‹questions
How to refresh table data after deleting a record in Wasp?
Let me know your thoughts on this đŸ™‚
18 replies
WWasp
Created by infelipe Gomes on 4/15/2025 in #đŸ™‹questions
How to refresh table data after deleting a record in Wasp?
I'm not sure using queryClientInitialized is ideal, safe, recommended, or intentional (was it supposed to be exported?), but it solves the issue regardless
18 replies
WWasp
Created by infelipe Gomes on 4/15/2025 in #đŸ™‹questions
How to refresh table data after deleting a record in Wasp?
Hi! I managed to solve this problem by importing queryClientInitialized (from queryClientInitialized) and using it like this: (await queryClientInitialized).invalidateQueries(getTasks.queryCacheKey) It worked, but I rather rely on the entities array defined in my main.wasp file. The problem, however, is that they aren't working as expected, at least for me - which is why I'm here đŸ˜› See, I'm working on a scaffolder to generate a admin dashboard for me based on my schema. I was testing it with something simple (the "to do" example in the docs) and that's how I found this issue. Essentially, I have 4 pages (index, new, show, edit), and my index page has a table with an actions column that allows the user to delete a record. The table isn't updated after the record is successfully deleted unless the page is manually refreshed (which is expected, of course).
18 replies
WWasp
Created by infelipe Gomes on 4/15/2025 in #đŸ™‹questions
How to refresh table data after deleting a record in Wasp?
@kapa.ai How can I use react-query to manually invalidate a query?
18 replies
WWasp
Created by infelipe Gomes on 4/7/2025 in #đŸ™‹questions
Test fails due to unresolved "@tanstack/react-query" import
@kapa.ai is that ok to add a setup file for Vitest or is there another way to add global mocks in Wasp?
20 replies
WWasp
Created by infelipe Gomes on 4/7/2025 in #đŸ™‹questions
Test fails due to unresolved "@tanstack/react-query" import
Hey hey Sorry for the late reply, folks So, it seems the problem lies with Mantine (Wasp is innocent) My package.json is fine, no changes there aside from adding Mantime Was taking a look at the docs yesterday and Mantine needs a custom render function to wrap the contents with MantineProvider My bad, yesterday was a rough day at work, and I missed an important detail - wasn't thinking straight Anyway, I will implement the custom render function later today and it might solve the issue I described I apologize for the concern Thank you all!
20 replies
WWasp
Created by infelipe Gomes on 4/7/2025 in #đŸ™‹questions
Test fails due to unresolved "@tanstack/react-query" import
@kapa.ai Already tried everything you suggested, but I keep having the same issue with the same logs
20 replies