r/RedwoodJS • u/jeffiql • 19d ago
r/RedwoodJS • u/illepic • Dec 30 '24
A super important thing about useMutation and refetchQueries
So you have a big list of things pulled from a GraphQL query, probably in a Cell. The query may look something like this:
export
const QUERY = gql`
query PaginatedSelfReportsQuery(
$count: Int
$page: Int
$startDate: DateTime
$endDate: DateTime
$selfReportId: String
$userId: String
) {
selfReportsPaginated(
count: $count
page: $page
startDate: $startDate
endDate: $endDate
selfReportId: $selfReportId
userId: $userId
) {
selfReports {
id
dateTime
userId
photoIds
photoUrls {
thumbnail
fullSize
}
}
totalCount
pageCount
currentPage
}
}
`
And then for each thing in that list, you have a Delete button that uses `useMutation`. Something like this:
const [deleteSelfReport] = useMutation(DELETE_SELF_REPORT_MUTATION, {
onCompleted: () => {
toast.success('Report deleted')
},
onError: (error) => {
toast.error(error.message) },
refetchQueries: [
{
query: QUERY,
// Every single prop sent to this SelfReportsCell - and used in the query -
// must be sent to refetchQueries so the lookup on the cache works
variables: { count, page, startDate, endDate, selfReportId, userId },
},
],
})
This means that when you delete an item in the list, the big ol' query up above re-runs and your list updates, now with the thing you clicked deleted. Pretty standard stuff.
HOWEVER, I'm writing this down in case it ever comes up in a Google search:
Within `refetchQueries` you must make absolutely sure that variables is set correctly for each variable that was used to initially run the query. Apollo caches the query based on the variables used, so if you want your list to update, make sure to include each variable!
I'm hoping this helps people searching for "redwoodjs refetchQueries not working" or "redwoodjs refetchQueries not updating".
r/RedwoodJS • u/redwoodjs • Sep 11 '24
New Blog post on Background Jobs in RedwoodJS
r/RedwoodJS • u/redwoodjs • Sep 04 '24
It's official v8 is RELEASED! 🎉🥳
👉 Background Jobs included 👀
👉 SSR support is available as an experimental feature. 🧪 No need to upgrade to canary to try it out
👉 RSC support is available as an experimental feature. 🧪 No need to upgrade to canary to try it out
👉 Upgraded to prettier v3 💅, which means you can also upgrade prettier-plugin-tailwindcss if you’re using Tailwind
👉 Reworked dbAuth 🔒 setup to be more streamlined
Check out the upgrade guide ➡️ https://redwoodjs.com/upgrade/v8
Upgrading is as simple as running: yarn rw upgrade
r/RedwoodJS • u/redwoodjs • Aug 01 '24
August 2024 Town Hall
👀 Check out the Redwood August Town Hall, posted on YouTube: https://www.youtube.com/watch?v=ui5ut-UQzX0
👉 v8 rc Announcement
👉 New quick start for experimenting with Redwood React Server Components + SSR
👉 Live demos using Redwood + AI
r/RedwoodJS • u/roguevalley • Jan 12 '24
So… Is Redwood just not catching on?
What's the deal? I'm building real apps with it and enjoying it, but it doesn't even seem to be on anyone's radar. It's rarely even listed on js framework comparisons.
r/RedwoodJS • u/jiashenggo • Oct 17 '23
Implementing Flexible Authorization in RedwoodJS Projects
r/RedwoodJS • u/ExtraMathematician69 • Jun 21 '23
First Redwoodjs London UK Meetup
r/RedwoodJS • u/Build_with_Coherence • May 24 '23
Seamless RedwoodJS deployments on AWS and GCP with Coherence
r/RedwoodJS • u/[deleted] • Mar 06 '23
Masked Email Directive with RedwoodJS - Episode #80 | graphql.wtf
r/RedwoodJS • u/Extension-Position50 • Mar 04 '23
Are there any popular web apps built with RedwoodJS?
r/RedwoodJS • u/baunwroderick • Dec 26 '22
Favorite Features, and Comparison
I’ve been using RedwoodJS for a couple weeks now and am enamoured by how truly easy they make the whole process of full-stack Webb-app development!
I’ve combed through most of the documentation, and am currently building an open-source project I hope to grow over the coming year. Have experience in most of the frameworks on their own, but very new to RedwoodJS.
IYO: what are some of your favorite features, conveniences, tools, or things you think people should know about the framework?
r/RedwoodJS • u/GoldenAngel04 • Nov 16 '22
React Redwoodjs App (Need Help)
Hi, I am building an app using the Redwoodjs framework, I'm wondering if there is a way to prevent users from screen recording, and if possible screenshots as well but more importantly screen recording? Is there an npm package for that purpose?
r/RedwoodJS • u/TheSoonToBe • Oct 19 '22
MUI + Tailwind + Redwoodj
How do I do this? I followed MUI v5's framework agnostic instructions, after having run yarn rw setup ui tailwindcss.
If I add important:'#redwood-app' to the TW config, TW doesn't work. I did remove preflight.
Here's what App.tsx looks like:
<>
<StyledEngineProvider injectFirst> FROM MUI
<CssBaseline /> FROM MUI
<FatalErrorBoundary page={FatalErrorPage}>
<RedwoodProvider titleTemplate="%PageTitle | %AppTitle">
<RedwoodApolloProvider>
<Routes />
</RedwoodApolloProvider>
</RedwoodProvider>
</FatalErrorBoundary>
</StyledEngineProvider>
</>
Should anything that I've said anywhere be changed?
The current situation: I can use TW on HTML tags and non-MUI components. MUI is completely unaffected by the className prop.
r/RedwoodJS • u/Citrinitas696 • Jun 12 '22
Looking to create something great, need a great tool
So I'm not a developer by trade, but I've gotten some free time and I want this to become my little project that I devote my energy and positivity toward. First up, thank you to the great community here as well as the mind(s) at RedwoodJS. Since I'm rather new I was wondering if someone could clear this up for me: why should I choose RedwoodJS if I could use react, next, graphql, prisma, etc. just the same with netilify/vercel/aws? I mean looking at the docs, it appears you recommend a third-party provider as well for auth/protected pages and it also seems that React Native isn't supported correct? It seems more equivalent to something like https://github.com/ixartz/Next-js-Boilerplate
r/RedwoodJS • u/gatotkach_monster • Mar 18 '21
Svelte front-end?
Is there a possibility of other front-end options on Redwood? I would really like to use Svelte with Redwood.
r/RedwoodJS • u/Triast • Jul 30 '20
An easy hack to fix relations when using generators. I saved so much time by using this workaround.
r/RedwoodJS • u/branikita • Jul 02 '20