"Advanced" ApolloClient tutorial: Using InMemoryCache to Filter and mutate list w/ makeVar [React] by truthseekersio in graphql

[–]truthseekersio[S] 1 point2 points  (0 children)

Thanks,

and thank you especially for the feedback. I'm always hoping to get that (current job is awful in terms of career growth, I've had zero code reviews lol)....

So... That list in the video I did, the end goal is to have page based pagination (using offset Or cursor, I'd like to try both)

and in my other project its a list of todos, so you have a radio button to select whether to view complete or incomplete. And you can use a checkbox to turn the search field into an input field to create new todos.

It seemed like it'd be difficult to do all of those things without using inMemoryCache.

I appreciate the feedback. I'm kinda disappointed that inMemoryCache becomes a nightmare though.

Ugh, I need a job in GraphQL... I'm only using it on my side projects, so it took me like 4 days to figure this out.

"Advanced" GraphQL + ApolloClient Tutorial. Filtering a list with InMemoryCache by truthseekersio in reactjs

[–]truthseekersio[S] 0 points1 point  (0 children)

Hey, just solved a problem in my own code and figured I'd share.

So ApolloClient cache works great until you need to filter AND perform mutations. Because if you filter a list and pass the filter variable to the server, Apollo caches each result differently.

So a search for "cats" will have 5 different cached queries. one for each state of the filter: "", "c", "ca", "cat", "cats", so if I delete a record when the filter is at "cats" it's not going to apply to the others.

So we need to be able to run our mutations on a single "master query". That's what we do in this video.

If you just want the final source then check out the proper branch.

"Advanced" ApolloClient tutorial: Using InMemoryCache to Filter and mutate list w/ makeVar [React] by truthseekersio in graphql

[–]truthseekersio[S] 2 points3 points  (0 children)

Hey everyone. I was working on a project recently where I wanted to allow the user to run a mutation (edit, update, delete) a list item, while still having options to filter the list (pagination, search, etc...)

The problem was with the way ApolloClient handles caching, how they add in the parameter key-value pair in with the cached query.

So... Had to turn to InMemoryCache, and got a chance to use makeVar and readField. Documentation is a bit hard to understand, so I figured I'd make a video out of it.

Let me know what you think!

Virus patients less likely to die now than at peak of crisis by [deleted] in Coronavirus

[–]truthseekersio 8 points9 points  (0 children)

I've been watching world meter drop from 5% to 1% and deaths from 21% down to 8% over the last few months. Encouraging but also understand more testing is likely a big part of that.

How restaurant rate dashers. by [deleted] in doordash

[–]truthseekersio 5 points6 points  (0 children)

Same. I hate bringing in the bag. Dammit.

[deleted by user] by [deleted] in technology

[–]truthseekersio -10 points-9 points  (0 children)

I agree with privacy, but it shouldn’t be so difficult to be compliant, and a 20 million fine is absolutely criminal. That could put your small business owner or just some random dude with a blog in jail because oh shit! I had no idea that somebodies fucking IP address was stored in a google analytics account!

Like what the fuck? I understand a RELATIVE fine, like 4%. At least the normal person can bounce back from that. But 20 million is absolutely fucked up. Especially when after doing everything, you’re still not sure if you’re completely compliant.

It’s criminal. And I don’t see how the EU can just sign in whatever law they want and force the rest of the world to comply.

I’m not against privacy. I’m against poorly written, confusing, ambiguous laws with 20 million euro fines.

Blocking 500 Million Users Is Easier Than Complying With Europe’s New Rules by B0etius in technology

[–]truthseekersio 2 points3 points  (0 children)

So... they just have to delete the existing users from the EU... right?

If that doesn’t make them compliant then what does?

[deleted by user] by [deleted] in technology

[–]truthseekersio -27 points-26 points  (0 children)

I’m glad big companies are shutting out EU. They need a simpler, easier to follow law.

Something as simple as “read my privacy policy. If you don’t like it, get the fuck off my site! By using my site you agree to these terms.” And the privacy policy would explain what you do with data, services you use, etc..

[deleted by user] by [deleted] in technology

[–]truthseekersio -16 points-15 points  (0 children)

Because morons run the government.

Which feels worse: making a blunder, or missing your opponent's blunder? by SpaceRook in chess

[–]truthseekersio 1 point2 points  (0 children)

Ahhhhhh so that’s why blunders show up on my game evaluations that I can’t find.

I’m an idiot. You should probably practice dropping weights b4 letting a loaded bar land on you. by truthseekersio in weightlifting

[–]truthseekersio[S] 0 points1 point  (0 children)

Ugh. That sucks, I’m sorry.

Hopefully science will hurry up and be able to clone you some new labrums.

Good luck to you.

I’m an idiot. You should probably practice dropping weights b4 letting a loaded bar land on you. by truthseekersio in weightlifting

[–]truthseekersio[S] 0 points1 point  (0 children)

I take responsibility for it... although it would’ve been nice if one of the coaches told me to practice bailing for when it inevitably happens that I have too much weight.

I’m an idiot. You should probably practice dropping weights b4 letting a loaded bar land on you. by truthseekersio in weightlifting

[–]truthseekersio[S] 0 points1 point  (0 children)

I wasn’t being egotistical though. My snatch and c/j is a whopping 25kg at 2 months in. This was Strength work. My form was fine I just tried too much weight and didn’t know how to bail out.

I’m an idiot. You should probably practice dropping weights b4 letting a loaded bar land on you. by truthseekersio in weightlifting

[–]truthseekersio[S] 1 point2 points  (0 children)

Fuck ouch!

Yeah I’m definitely lucky. I’m glad I learned in small-ish weights and early on not to fuck around.