You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: transition from MobX to React Query and clean up legacy code
- Updated the `CLAUDE.md` documentation to reflect the migration from MobX to React Query for state management, including changes to project context and data fetching practices.
- Removed deprecated MobX hooks and utilities, streamlining the codebase and enhancing maintainability.
- Consolidated project context management under `ProjectContext`, ensuring all new features utilize React Query for data handling.
These changes support a more efficient architecture and improve the overall clarity of the application.
**See:**`MIGRATION_PLAN.md` for detailed phases, checklists, and risk analysis
340
-
341
-
**Steps**
342
-
343
-
1. Create `model/queries.ts` with domain types in the feature.
344
-
2. Move fetching from Store to `useQuery`/`useMutation`.
345
-
3. Add DTO → domain mappers.
346
-
4. Update UI to use hooks instead of store.
347
-
5. Keep `observer()` only where `projectsStore` is read.
348
-
6. Remove the legacy store and `useLocalObservableWithDestroy`.
349
-
7. Verify refetch on `projectId` change.
281
+
# 10) Migration history (MobX → React Query)
350
282
351
-
---
283
+
**Historical context:** The project previously used MobX stores for server state management. In 2025, we completed a full migration to React Query (`@tanstack/react-query`) for all CRUD and data fetching operations.
352
284
353
-
# 11) Global stores (rare exceptions)
285
+
**Current state:**
286
+
- ✅ All major features use React Query (API Keys, Webhooks, Statistics, Liteproxy, Pricing, Balance, Rates, NFT, Faucet, App Messages, Jetton, Projects)
287
+
- ⚠️ A few isolated modules (Invoices, Analytics, Airdrop) retain localized MobX stores within their components for internal state management only
288
+
- ✅ No global stores — `ProjectContext` manages project selection with React Query
354
289
355
-
Allowed:
356
-
357
-
*`projectsStore` — current project selection (often needed for `project_id`)
358
-
*`userStore` — auth/profile
359
-
*`appStore` — global UI state
360
-
361
-
**Prohibited:** adding feature stores into `root.store.ts`. That indicates an incorrect responsibility boundary.
290
+
**For new features:** Always use React Query. See patterns in §5.1 and examples in §19.
362
291
363
292
---
364
293
365
-
# 12) Self‑update protocol (for AI)
366
-
367
-
**Goal:** keep this file up-to-date and compact, without clutter.
368
-
369
-
**Golden rules**
370
-
371
-
1. Do not duplicate rules; if there is a conflict, link to the existing point and refine the wording in a single place.
372
-
373
-
**Before writing changes AI must:**
374
-
375
-
* make sure the changes reflect the actual state of the code/repo;
376
-
377
-
---
378
-
379
-
# 13) Security and secrets
294
+
# 11) Security and secrets
380
295
381
296
* Do not log secrets/API keys/tokens.
382
297
* Environment configuration via **ENV**, no hardcoding.
383
298
* TON API permissions — only via backend proxies where applicable.
384
299
385
300
---
386
301
387
-
# 14) Performance
302
+
# 12) Performance
388
303
389
304
* Real-time: use `refetchInterval` only where needed (see Balance).
390
305
* Use `staleTime` consciously; by default treat data as "stale" for freshness.
@@ -393,15 +308,15 @@ Allowed:
393
308
394
309
---
395
310
396
-
# 15) UX, accessibility
311
+
# 13) UX, accessibility
397
312
398
313
* States (loading/error/empty) are mandatory.
399
314
* Keyboard accessibility for modals and focus — Chakra is fine by default, do not break it.
400
315
* All text is in English.
401
316
402
317
---
403
318
404
-
# 16) Time series and periods (TON metrics)
319
+
# 14) Time series and periods (TON metrics)
405
320
406
321
* Time units in API: unix (seconds).
407
322
* Common case: last 7 days with 30-minute intervals.
@@ -410,7 +325,7 @@ Allowed:
410
325
411
326
---
412
327
413
-
# 17) Git and workflow
328
+
# 15) Git and workflow
414
329
415
330
* Branch from `master`. Commits are atomic.
416
331
* Commit messages are meaningful.
@@ -426,13 +341,27 @@ Allowed:
426
341
427
342
---
428
343
429
-
# 19) Examples (reference snippets)
344
+
# 16) Self‑update protocol (for AI)
430
345
431
-
## 19.1 CRUD component (pattern)
346
+
**Goal:** keep this file up-to-date and compact, without clutter.
347
+
348
+
**Golden rules**
349
+
350
+
1. Do not duplicate rules; if there is a conflict, link to the existing point and refine the wording in a single place.
351
+
352
+
**Before writing changes AI must:**
353
+
354
+
* make sure the changes reflect the actual state of the code/repo;
0 commit comments