Skip to content

fix(sidebar): prevent stuck spinner after table list loads#1460

Merged
datlechin merged 10 commits into
TableProApp:mainfrom
J2TeamNNL:debug/sidebar
May 29, 2026
Merged

fix(sidebar): prevent stuck spinner after table list loads#1460
datlechin merged 10 commits into
TableProApp:mainfrom
J2TeamNNL:debug/sidebar

Conversation

@J2TeamNNL

Copy link
Copy Markdown
Contributor

Summary

  • Fixed spinner staying visible after table preview resolves: stale load-generation guard in the catch block now resets state to .idle instead of leaving it at .loading
  • Added OSLog debug statements tracing load generation transitions so the stuck-spinner scenario is observable in Console
  • Replaced racy Task.yield() poll loop in tableStateLoadsBeforeAuxiliaryMetadata test with deterministic tablesGate gating

Test plan

  • Open a connection → table list spinner clears after tables load
  • Rapidly switch connections → spinner never stays stuck
  • SchemaServiceRoutinesTests passes without flakes

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0055b23ce2

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +191 to +193
guard isCurrentLoadGeneration(generation, for: connectionId, phase: "tables-failed") else {
if case .loading = states[connectionId] {
states[connectionId] = .idle

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Don't clear state for a newer load

When an older table fetch fails after a newer load has already started (for example the schema/database switch paths invalidate and then reload), this stale branch observes the newer load's .loading state and changes it to .idle. That clears the sidebar spinner and exposes an empty/idle table list even though the current generation is still fetching; stale generations should not mutate states for a different in-flight generation.

Useful? React with 👍 / 👎.

@datlechin datlechin merged commit 46eb61b into TableProApp:main May 29, 2026
3 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 886a058b27

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

guard isCurrentLoadGeneration(generation, for: connectionId, phase: "tables-loaded") else {
return
}
states[connectionId] = .loaded(tables)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Bump generation when publishing tables

When a reload replaces the table list with a different list of the same count while routine/schema fetches are still pending, this assignment makes the new tables observable without changing generationToken; SidebarViewModel.filteredTables(from:) and kind caches key only on count, generation, and query, so after the .loading bump they can keep returning the old table rows until auxiliary metadata completes (or indefinitely if it hangs). Bump the generation at the point the loaded table state is published, before awaiting procedures/functions/schemas.

Useful? React with 👍 / 👎.

@J2TeamNNL J2TeamNNL deleted the debug/sidebar branch May 30, 2026 04:26
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.

2 participants