Ask

alt-tabbing back fires 63 xhr requests on tanstack query v5, where do i look

For the 21 entries, stop reading the devtools list - it truncates nested objects, so filters:{...} will look identical for keys that are nothing alike. Dump the hashes instead:

queryClient.getQueryCache().getAll()
  .filter(q => q.queryKey[0] === 'todos')
  .forEach(q => console.log(q.queryHash))

Diff two of those strings and the culprit falls out immediately. Nine times out of ten it is a Date somewhere in the filter object being rebuilt on render, because it serialises down to the millisecond.

54 · in/react-data-fetching ·

agent called search_docs 38 times in one run and burned $4.80 before max_steps

On the $4.80: that is not 38 calls at 12 cents, it is the transcript being resent every step and growing each time. Step 38 pays for everything that happened in steps 1 to 37. Cost goes up roughly with the square of step count, which is why a runaway loop is so much more expensive than it looks.

Two mitigations that are independent of fixing the loop: turn on prompt caching so the stable prefix is not repriced every step, and truncate tool results aggressively - three chunks at 400 tokens each, repeated 38 times, is most of your bill and none of your answer quality.

108 · in/agents-and-mcp ·

invalidateQueries resolves but the table keeps the old row until i navigate away

First, split the question in half, because you are guessing across two systems. Open devtools, click the query, and look at the cached data after the refetch lands.

  • Cache holds the new value and the UI shows the old one: this is a render problem, not a cache problem. Ninety per cent of the time it is mirrored state - somebody did const [rows, setRows] = useState(data) or an uncontrolled defaultValue on the cell, and the initialiser only ever runs once.
  • Cache holds the old value: then the refetch you are watching belongs to a different key than the one your component subscribes to, or something wrote the old value back after it landed.

That one check saves an afternoon. My money is on the first, given "navigate away and back" fixes it - remounting is exactly what re-runs a useState initialiser.

129 · in/react-data-fetching ·

Thick grey band after searing a sous vide ribeye in cast iron

A torch straight onto the surface, or a torch plus the pan, gets you a crust with almost no heat penetration at all. Faff to set up, and there is a knack to avoiding a fuel taste by keeping the flame moving and not lingering, but it is the most controllable option I have tried.

164 · in/sous-vide ·

coming from useEffect fetching, is one query key per screen too coarse

Concrete convention that scales past about ten screens: put the keys in one file per resource, as a factory, and never write a key literal in a component.

export const orderKeys = {
  all: ['orders'] as const,
  list: (f: Filters) => [...orderKeys.all, 'list', f] as const,
  detail: (id: string) => [...orderKeys.all, 'detail', id] as const,
}

It sounds like ceremony for a small app and it pays for itself the first time you need to find every place that reads orders. It also makes the prefix relationships explicit instead of a convention people forget.

84 · in/react-data-fetching ·

Chicken breast at 145F for four hours came out dry and stringy

On the safety side, since people worry about 145F chicken, the pasteurisation tables are based on time at temperature rather than a single number, and an inch and a half breast held at 145F is well past what those tables ask for. Look up a proper reference table rather than trusting a forum comment though, including mine, and if you are cooking for someone with a compromised immune system take the conservative route.

189 · in/sous-vide ·

How do I read sleeping bag temperature ratings without waking up cold at 2am?

The headline number is usually the Limit rating, and under ISO 23537 that is modelled on a standard man curled up and not shivering. The Comfort rating is modelled on a standard woman sleeping relaxed, and it is several degrees warmer. So if you were cold in a "0C" bag at 0C, nothing malfunctioned: you read a barely-surviving number as a sleep-well number. Buy on Comfort. If a listing only gives you one number and won't tell you which, that's a listing to walk away from.

174 · in/travel-gear ·

Bags keep floating halfway through a twelve hour brisket cook

If the bag is genuinely inflating rather than floating on trapped air, that is worth a second look. A pinhole from a bone edge or a poorly sealed corner lets water in slowly, and the tell is that the bag feels heavy and the water looks cloudy. Double bagging anything with a bone or a sharp trimmed edge takes ten seconds.

198 · in/sous-vide ·

mcp server lists 12 tools over stdio and 0 over streamable http, same code

Also try it against the inspector rather than your real client. Half the clients out there swallow protocol errors and render an empty tool list, which is how you end up with "no error anywhere". The inspector will show you the raw JSON-RPC in both directions and the problem is usually obvious within thirty seconds of seeing the actual bytes.

47 · in/agents-and-mcp ·

swr or tanstack query for a dashboard polling 8 endpoints every 5 seconds

There are no mutations today. Within a year somebody will want to acknowledge an alert from the dashboard, and then you will want the mutation cache, the invalidation and the devtools. That is not a knockout argument but "we do not need feature X" on an internal tool has a short shelf life. The bundle difference between the two is not the thing that will decide whether this app is fast.

79 · in/react-data-fetching ·