Skip to content

fix automation list flicker on initial load#3772

Merged
saddlepaddle merged 1 commit intomainfrom
fix-automation-flicker
Apr 26, 2026
Merged

fix automation list flicker on initial load#3772
saddlepaddle merged 1 commit intomainfrom
fix-automation-flicker

Conversation

@saddlepaddle
Copy link
Copy Markdown
Collaborator

@saddlepaddle saddlepaddle commented Apr 26, 2026

Summary

  • Gate the automations page body on the Electric SQL collection's isReady so the empty-state placeholder doesn't flash for a frame or two before rows hydrate.

Test plan

  • Open Automations with existing automations: no AutomationsEmptyState flash before the table renders.
  • Open Automations with zero automations: empty state appears once, no flicker.

Summary by cubic

Fixes initial flicker on the Automations page by gating rendering on the Electric SQL automations collection’s isReady. The empty state no longer flashes before data hydrates; it only appears when there are no automations.

Written for commit 3e300bf. Summary will update on new commits.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed automations list displaying an empty state during initial data load, preventing confusing UI transitions while data is being fetched.

Wait for the Electric SQL automations collection to hydrate before
rendering the body. Without this gate, the empty-state placeholder
flashes for a frame or two before the real rows arrive.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 26, 2026

📝 Walkthrough

Walkthrough

The automations page component now checks whether the query is ready before rendering, preventing the empty state from displaying during initial data loading. This prevents a brief flash of an empty interface.

Changes

Cohort / File(s) Summary
Query Readiness Check
apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/page.tsx
Updated useLiveQuery handling to track automationsReady flag and render null instead of AutomationsEmptyState until the query completes, eliminating empty state flash during load.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A query that whispers "not quite ready yet,"
Now waits for the data before we should fret,
No empty state flashing, no UI so bare,
Just patience and loading—done with such care! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix automation list flicker on initial load' directly and clearly describes the main change—addressing a UI flickering issue during initial load by preventing premature rendering of the empty state.
Description check ✅ Passed The description includes a summary of changes and test plan, but is missing required template sections like Related Issues, Type of Change, Testing details, and Additional Notes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-automation-flicker

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 26, 2026

Greptile Summary

This PR fixes an empty-state flicker on the Automations page by gating the page body on the isReady flag from the useLiveQuery (Electric SQL) collection. The same pattern is already used in v2-workspace/layout.tsx, confirming it is the established approach in this codebase.

Confidence Score: 5/5

Safe to merge — the two-line change correctly gates rendering on the established isReady pattern already used elsewhere in the codebase.

All findings are P2 (no loading indicator is a UX polish suggestion, not a correctness issue). The fix is minimal, follows existing conventions (v2-workspace/layout.tsx), and isReady is a confirmed return field of useLiveQuery in this codebase.

No files require special attention.

Important Files Changed

Filename Overview
apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/page.tsx Adds isReady guard to prevent AutomationsEmptyState from flashing before data hydrates; renders null while loading with no loading indicator shown to the user.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[AutomationsPage renders] --> B{automationsReady?}
    B -- false --> C[render null\nblank content area]
    B -- true --> D{automations.length === 0?}
    D -- yes --> E[AutomationsEmptyState]
    D -- no --> F{visible.length === 0?}
    F -- yes --> G[Scope-specific empty message]
    F -- no --> H[Automations Table]
Loading
Prompt To Fix All With AI
This is a comment left during a code review.
Path: apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/page.tsx
Line: 231

Comment:
**No loading indicator while waiting for `isReady`**

While `!automationsReady`, the content area renders `null`, leaving the `div.flex-1` visually blank. The flicker fix is correct, but users on slower syncs will see an empty grey region rather than any loading feedback. Consider a skeleton or spinner to make the loading state explicit:

```suggestion
			{!automationsReady ? (
				<div className="flex items-center justify-center h-full text-muted-foreground text-sm">
					Loading…
				</div>
			) : automations.length === 0 ? (
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix automation list flicker on initial l..." | Re-trigger Greptile


<div className="flex-1 overflow-y-auto px-8 py-6">
{automations.length === 0 ? (
{!automationsReady ? null : automations.length === 0 ? (
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 No loading indicator while waiting for isReady

While !automationsReady, the content area renders null, leaving the div.flex-1 visually blank. The flicker fix is correct, but users on slower syncs will see an empty grey region rather than any loading feedback. Consider a skeleton or spinner to make the loading state explicit:

Suggested change
{!automationsReady ? null : automations.length === 0 ? (
{!automationsReady ? (
<div className="flex items-center justify-center h-full text-muted-foreground text-sm">
Loading…
</div>
) : automations.length === 0 ? (
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/page.tsx
Line: 231

Comment:
**No loading indicator while waiting for `isReady`**

While `!automationsReady`, the content area renders `null`, leaving the `div.flex-1` visually blank. The flicker fix is correct, but users on slower syncs will see an empty grey region rather than any loading feedback. Consider a skeleton or spinner to make the loading state explicit:

```suggestion
			{!automationsReady ? (
				<div className="flex items-center justify-center h-full text-muted-foreground text-sm">
					Loading…
				</div>
			) : automations.length === 0 ? (
```

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/page.tsx (1)

230-231: Consider a lightweight loading placeholder instead of null.

Rendering null until the live query is ready fixes the empty-state flicker, but it leaves the body area blank during the (typically brief) hydration window. If hydration is ever slow (cold start, large collection), users will see an empty header with no feedback. A subtle skeleton or spinner inside the scroll container would preserve the no-flicker behavior while signaling that content is loading.

♻️ Optional sketch
-				{!automationsReady ? null : automations.length === 0 ? (
+				{!automationsReady ? (
+					<div className="flex h-full items-center justify-center text-sm text-muted-foreground">
+						{/* or a skeleton matching the table layout */}
+					</div>
+				) : automations.length === 0 ? (
 					<AutomationsEmptyState onSelectTemplate={handleSelectTemplate} />

Feel free to ignore if hydration is reliably fast enough that a placeholder would itself flash.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/page.tsx`
around lines 230 - 231, The body container currently returns null while waiting
for the live query (when !automationsReady) which leaves the scroll area blank;
replace that null with a lightweight placeholder (e.g., a subtle spinner or
skeleton component) inside the same div (the element with className "flex-1
overflow-y-auto px-8 py-6") so the header stays stable but users see loading
feedback; update the page component's render conditional around
automationsReady/automations to render a small LoadingSkeleton or Spinner
component while automationsReady is false, keeping the existing
automations.length === 0 handling unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/page.tsx`:
- Around line 230-231: The body container currently returns null while waiting
for the live query (when !automationsReady) which leaves the scroll area blank;
replace that null with a lightweight placeholder (e.g., a subtle spinner or
skeleton component) inside the same div (the element with className "flex-1
overflow-y-auto px-8 py-6") so the header stays stable but users see loading
feedback; update the page component's render conditional around
automationsReady/automations to render a small LoadingSkeleton or Spinner
component while automationsReady is false, keeping the existing
automations.length === 0 handling unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 755ecdb9-d784-4479-b6f1-84c19e02502d

📥 Commits

Reviewing files that changed from the base of the PR and between 2c119ad and 3e300bf.

📒 Files selected for processing (1)
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/page.tsx

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

@saddlepaddle saddlepaddle merged commit 97c48d7 into main Apr 26, 2026
7 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ⚠️ Neon database branch

Thank you for your contribution! 🎉

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