diff --git a/.cursor/rules/responsive-data-fetching.mdc b/.cursor/rules/responsive-data-fetching.mdc new file mode 100644 index 0000000..32c0c7c --- /dev/null +++ b/.cursor/rules/responsive-data-fetching.mdc @@ -0,0 +1,26 @@ +# Responsive layout vs data fetching + +When adding or changing pages with mobile/desktop views: + +## UI layer (responsive) + +- Switch layouts with **`v-show`**, not **`v-if`**, so resize does not destroy child components. +- Prefer `ResponsiveViewPair` (`src/layouts/components/ResponsiveViewPair.vue`) or the home shell pattern. +- Keep **``** outside responsive chrome wrappers (header/topbar only in chrome components). +- Modal vs ActionSheet may use `v-if` by breakpoint; they must not own initial page data fetching. + +## Data layer (fetch once) + +- Call the page composable **once** in the route `index.vue` shell (e.g. `useXPage()` / `useXPageProvider()`). +- Put `onMounted` API calls only in that shell composable, never in `mobile/*` or `desktop/*` views. +- Mobile/Desktop views use **`useXPageContext()`** (provide/inject) — read-only UI. +- Do not call APIs inside `useDesktopBreakpoint()` watchers. + +## Shared caches + +- Use `runOnceAsync` (`src/composables/useOnceAsync.ts`) for store-level dedup when the same endpoint may be hit from multiple mounts. +- Reuse existing module caches (`useWalletAssets`, Pinia stores) before adding new fetch logic. + +## Verify + +- Open Network tab, load a page, resize across 768px — **no duplicate requests** for the same endpoint. diff --git a/src/components/BasicPacks/BasicInput.vue b/src/components/BasicPacks/BasicInput.vue index 95db065..9012c27 100644 --- a/src/components/BasicPacks/BasicInput.vue +++ b/src/components/BasicPacks/BasicInput.vue @@ -35,7 +35,7 @@