Skip to content

fix(frontend): dedupe contact-table loads and scope mine table to the active run - #2908

Merged
malek10xdev merged 17 commits into
mainfrom
fix/mining-table-session-scope
Oct 5, 2026
Merged

malek10xdev merged 17 commits into
mainfrom
fix/mining-table-session-scope

Conversation

@malek10xdev

@malek10xdev malek10xdev commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Moves contact-table data ownership out of MiningTable into page-level orchestration, so /mine can never trigger a full-table load.

  • MiningTable is display-only: takes contacts + loading props, no loadContactsData, no prefetch, no subscriptions, no store resets. Filters/selection/actions untouched.
  • useTableData.ts owns both page lifecycles:
    • useContactsTableData (/contacts): full get_contacts_table load with refine fallback, normalization, visible columns, ?mining_id= deep link, contacts realtime subscription, unmount reset.
    • useMiningTableData (/mine): subscribes mine realtime while a task is active, stops on miningCompleted, resets on unmount. Zero full-load calls.
  • /contacts now simply loads the table and connects realtime — the realtime-reconnect recovery reload was removed.
  • Util cleanup: removed mining-table.ts (inlined its single helper into MiningTable), removed shouldReloadOnReconnect and the now-unneeded realtime scope/connect state, and dropped the extra getDefaultVisibleColumns util.

Test Plan

  • Unit tests: column defaults + contacts/mine lifecycle contracts (28 affected tests pass)
  • npm run lint: 0 errors; nuxi typecheck: only pre-existing baseline errors
  • E2E on local stack (agent-browser): /mine issues 0 get_contacts_table; /contacts loads exactly once and renders; no app console errors
  • Full Vitest suite: pre-existing unrelated failures only

@malek10xdev
malek10xdev force-pushed the fix/mining-table-session-scope branch from b3a54cf to 67dbbfd Compare September 23, 2026 22:46
The table-lifecycle migration moved column initialization into
useContactsTableData, where initializeVisibleColumns only ran after the
async full load. Until it resolved, the store sat at its checkbox-only
init value, so the table rendered with (almost) no visible fields.

- set the contacts defaults synchronously at mount, matching main
- treat a stored empty selection as "no preference" and fall through to
  data-driven columns instead of rendering an empty table
- cover both paths with unit tests
After merging main, the contacts store's auto-imported useSupabaseUser
resolves to the @nuxtjs/supabase runtime composable instead of a global,
so the stub no longer applied. Mock the resolved module paths (the
package only exports ".") alongside the global stub.
The "Mining in progress - Passive" row rendered the shared
scanned/extracted/cleaned refs, which only ever move for a foreground run
the user started themselves: those are fed by the single foreground SSE in
startProgressListener, and a passive run happens server-side. So a healthy
passive run showed 0/0/0 for its whole duration.

- subscribe one independent progress stream per in-progress passive run
  (own AbortController, so it cannot cancel or be cancelled by the shared
  sse singleton the foreground mine page uses)
- reconcile those streams from the existing /sources polling loop, which
  already refreshes passive state, so a run that starts while the page is
  open shows up without a reload
- read the counters per source in the template, keeping the shared refs
  for foreground runs
- drop streams and cached counters when a run ends or mining resets
@malek10xdev
malek10xdev merged commit 134d32e into main Oct 5, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant