Skip to content

fix(frontend): stop empty-state splash from flashing after login#12966

Merged
ogabrielluiz merged 2 commits into
release-1.10.0from
fix/empty-page-flash-on-login
May 15, 2026
Merged

fix(frontend): stop empty-state splash from flashing after login#12966
ogabrielluiz merged 2 commits into
release-1.10.0from
fix/empty-page-flash-on-login

Conversation

@ogabrielluiz
Copy link
Copy Markdown
Contributor

Summary

After signing in, the empty-state splash ("create your first flow") rendered for one frame even when the user already had flows. Two stacked bugs:

  1. `flowsManagerStore.resetStore()` set `flows: []` on logout. After logout → login, the truthy gate in `main-page.tsx` (`flows && examples && folders`) passed immediately with stale empty values, `shouldShowMainContent` returned false, and `EmptyPageCommunity` rendered until the new flows query resolved.
  2. `homePage/index.tsx` initialized `isEmptyFolder = true` and only flipped it inside a `useEffect`, so the first render of `HomePage` always rendered `EmptyFolder` regardless of actual state.

Changes

  • `flowsManagerStore.resetStore`: `flows: []` → `flows: undefined`. Matches the initial state and lets the gate correctly wait for the next fetch.
  • `homePage/index.tsx`: `isEmptyFolder` is now `boolean | null`, starting at `null` and only resolving once both the global flows store and the folder query have data. While `null`, the existing `ListSkeleton` renders instead of `EmptyFolder`.
  • Updated `flowsManagerStore.test.ts` to assert the new `undefined` reset value.

Verification

Captured with a `MutationObserver` watching the empty-state `data-testid`s during a real post-login transition.

Before the fix, four insertions in the same paint window:
```
EmptyFolder splash (data-testid="new_project_btn_empty_page")
EmptyPageCommunity (data-testid="empty_page_github_button")
EmptyPage logo light (data-testid="empty_page_logo_light")
EmptyPage logo dark (data-testid="empty_page_logo_dark")
```
After the fix: zero insertions.

Two bugs caused EmptyPageCommunity and EmptyFolder to render for one
frame between login success and the flows query resolving.

1. flowsManagerStore.resetStore() set flows: [] on logout. After
   logout/login the truthy gate in main-page.tsx (flows && examples &&
   folders) passed immediately with stale empty values, and
   shouldShowMainContent returned false, so EmptyPageCommunity rendered
   until the new flows query resolved. Reset to undefined instead so the
   gate correctly waits for the next fetch.

2. homePage initialized isEmptyFolder = true and only flipped it inside
   a useEffect, so the first render of HomePage always rendered
   EmptyFolder regardless of state. Use null as the resolving sentinel,
   skip the effect until both the global flows store and the folder
   query are populated, and render the existing list skeleton while
   resolving.

Verified with a MutationObserver in the post-login transition: prior to
this change three empty-state components were inserted into the DOM in
the same paint window; after the change none are.
@ogabrielluiz ogabrielluiz requested a review from Cristhianzl May 4, 2026 14:59
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 4, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 51236af8-8001-4018-a64d-a42300bca632

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/empty-page-flash-on-login

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.

@github-actions github-actions Bot added the bug Something isn't working label May 4, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 4, 2026

Codecov Report

❌ Patch coverage is 28.57143% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.31%. Comparing base (a556005) to head (eb074a2).
⚠️ Report is 26 commits behind head on release-1.10.0.

Files with missing lines Patch % Lines
...ontend/src/pages/MainPage/pages/homePage/index.tsx 23.07% 10 Missing ⚠️

❌ Your patch check has failed because the patch coverage (28.57%) is below the target coverage (40.00%). You can increase the patch coverage or adjust the target coverage.
❌ Your project check has failed because the head coverage (50.60%) is below the target coverage (60.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@                Coverage Diff                 @@
##           release-1.10.0   #12966      +/-   ##
==================================================
+ Coverage           53.90%   54.31%   +0.41%     
==================================================
  Files                2051     2091      +40     
  Lines              187497   191732    +4235     
  Branches            26653    27452     +799     
==================================================
+ Hits               101072   104147    +3075     
- Misses              85306    86430    +1124     
- Partials             1119     1155      +36     
Flag Coverage Δ
backend 57.54% <ø> (+0.27%) ⬆️
frontend 54.42% <28.57%> (+0.40%) ⬆️
lfx 50.60% <ø> (+0.61%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/frontend/src/stores/flowsManagerStore.ts 100.00% <100.00%> (ø)
...ontend/src/pages/MainPage/pages/homePage/index.tsx 52.36% <23.07%> (+0.71%) ⬆️

... and 144 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

Frontend Unit Test Coverage Report

Coverage Summary

Lines Statements Branches Functions
Coverage: 37%
37.45% (44822/119660) 67.62% (6198/9165) 37.13% (1029/2771)

Unit Test Results

Tests Skipped Failures Errors Time
4253 0 💤 0 ❌ 0 🔥 9m 57s ⏱️

Copy link
Copy Markdown
Member

@Cristhianzl Cristhianzl left a comment

Choose a reason for hiding this comment

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

lgtm

@github-actions github-actions Bot added the lgtm This PR has been approved by a maintainer label May 5, 2026
@ogabrielluiz ogabrielluiz enabled auto-merge May 5, 2026 18:48
The post-login flash guard waited for folderData to be defined, but
folderData stays undefined when the folder query errors out (e.g. when
myCollectionId is undefined after the user deletes all folders).
isEmptyFolder then stuck at null and the page rendered ListSkeleton
forever instead of EmptyFolder.

Gate on isLoading from useGetFolderQuery instead. isLoading is true
only on the first fetch with no data and flips to false on success
or error, so the effect still waits past the post-login stale-store
window but resolves correctly when the query settles either way.
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels May 6, 2026
@ogabrielluiz ogabrielluiz added this pull request to the merge queue May 6, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 6, 2026
@ogabrielluiz ogabrielluiz added this pull request to the merge queue May 15, 2026
Merged via the queue into release-1.10.0 with commit ac308a0 May 15, 2026
103 of 105 checks passed
@ogabrielluiz ogabrielluiz deleted the fix/empty-page-flash-on-login branch May 15, 2026 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants