---
title: "mohammad garmabi (@garmabi07) | Hashnode"
description: "mohammad garmabi (@garmabi07) writes on Hashnode. Read their latest articles and follow their work."
url: "https://hashnode.com/@garmabi07"
---

@garmabi07

# mohammad garmabi

@garmabi07 · Joined September 2026

## Comments

[Thanks, and you nailed the use case: the enabled switch exists precisely for staggered rollouts. Yes, one generator per subscriber is the intended shape. Each api.sse() call gets its own iterator, so finally cleanup stays scoped to that subscriber and unmounting one component never kills another's stream. If two subscribers need to see the same ticks, keep the shared state outside the generator. Create one module-level ticker (a setInterval plus a small listener set), and have each generator subscribe to it on start and unsubscribe in finally. Then the timer is shared, and the per-subscriber cleanup still works. You can also stop the interval when the listener set is empty, which mirrors how a real server behaves. In practice, the simpler fix is often one level up: if both components render the same feed, put the subscription in a shared hook or query so there's only one consumer in the first place.](https://hashnode.com/posts/mock-your-api-inside-the-client-http-sse-ndjson-websocket-with-tanstack-fetch/6af1739e443aa35f80419d91/comment/6af1974b79c8674ebaa2b472#reply-6af19d228e701a05b6b935ed)

Reply · Article · 2d ago · [Mock Your API Inside the Client: HTTP, SSE, NDJSON & WebSocket with tanstack-fetch](https://hashnode.com/posts/mock-your-api-inside-the-client-http-sse-ndjson-websocket-with-tanstack-fetch/6af1739e443aa35f80419d91)

[Exactly! That’s why I wanted to handle refresh logic at the HTTP client level rather than repeat it across individual queries. A shared refresh mechanism prevents parallel refresh requests, and keeping 401 and 403 separate avoids unnecessary refresh loops. Thanks for pointing that out!](https://hashnode.com/posts/building-production-ready-react-data-flows-with-tanstack-fetch-and-tanstack-query/6ad315b4a88e1f774db3a8e7/comment/6ad32d1606e54e9091d38d66#reply-6ad33fdf9dbd8aaffd04582a)

Reply · Article · Oct 17 · [Building Production-Ready React Data Flows with tanstack-fetch and TanStack Query](https://hashnode.com/posts/building-production-ready-react-data-flows-with-tanstack-fetch-and-tanstack-query/6ad315b4a88e1f774db3a8e7)
