Skip to content

Added loading spinner for Flows that take time to load - #1929

Open
gaokevin1 wants to merge 8 commits into
mainfrom
loading-spinner
Open

gaokevin1 wants to merge 8 commits into
mainfrom
loading-spinner

Conversation

@gaokevin1

Copy link
Copy Markdown
Member

Related Issues

Fixes https://github.com/descope/etc/issues/18199

Description

This change adds a configurable loading spinner for when flow screens take some time to load, or for when you're doing redirects via OAuth and SSO actions at the beginning of the flow.

Screenshots

Must

  • 📱 Responsiveness (mobile/XL resolutions)
  • 🧪 Tests
  • 📃 Documentation (if applicable)

@shuni-bot

shuni-bot Bot commented Sep 3, 2026

Copy link
Copy Markdown

🐕 Review complete — View session on Shuni Portal 🐾

🤖 Model: claude-opus-5

@gaokevin1
gaokevin1 requested a review from talkapi September 3, 2026 20:31
@gaokevin1
gaokevin1 requested a review from asafshen September 3, 2026 20:31
@shuni-bot

shuni-bot Bot commented Sep 3, 2026

Copy link
Copy Markdown

🐕 Suggested Reviewers

Loading spinner feature review assignment examines JSX and CSS contributions, prioritizes component overlay and responsive styling verification

Reviewer Reason
ckiee Reviews the new FlowLoadingOverlay component (FlowLoadingOverlay.tsx) and CSS styling changes (App.css, src/App.css) that implement the loading spinner UI and animations
omercnet Evaluates the main App changes (App.tsx) integrating the loading overlay, as well as App.css and the new FlowLoadingOverlay component for global loading spinner implementation
dorsha Assesses the flow integration (App.tsx) and loading overlay component (FlowLoadingOverlay.tsx) for redirect handling, overlay visibility logic, and spinner configuration
asafshen Reviews test coverage additions (App.test.tsx) for the loading spinner, .env.example configuration, and documentation updates (README.md) related to the new feature
talkapi Verifies the new component implementation (FlowLoadingOverlay.tsx), tests (App.test.tsx), and configuration/docs (README.md) for the loading spinner feature

Suggested by Shuni based on git history and PR context. Names are not @-mentioned to avoid notifying anyone — request a review from whoever fits best.

@gaokevin1
gaokevin1 requested a review from dorsha September 3, 2026 20:31
@gaokevin1
gaokevin1 enabled auto-merge (squash) September 3, 2026 20:34

@shuni-bot shuni-bot 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.

🐕 Shuni Review

Adds a full-screen loading overlay/spinner shown until the Descope flow fires onReady/onError, configurable via the loading and loading_color query params (defaulting to the bg color).

Actionable comments posted: 3

  • 1 🟠 Major: overlay never dismissed when FlowGate blocks the flow, permanently hiding the error screen
  • 2 🟡 Minor: http:// background URL leaks into the spinner color; color-mix() border shorthand drops the whole border on invalid/unsupported values

Merge risk: 🟡 Moderate: the blocked-domain path now renders an undismissable spinner over the error screen.

See inline comments for details.

🤖 Model: claude-opus-5


Review scope: Full review

Reviewed files (6)
  • .env.example
  • README.md
  • src/App.css
  • src/App.test.tsx
  • src/App.tsx
  • src/components/FlowLoadingOverlay.tsx

Comment thread src/App.tsx Outdated
Comment thread src/App.tsx Outdated
Comment thread src/App.css Outdated
@shuni-bot

shuni-bot Bot commented Sep 3, 2026

Copy link
Copy Markdown

🐕 Review complete — View session on Shuni Portal 🐾

🤖 Model: claude-opus-5

@shuni-bot shuni-bot 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.

🐕 Shuni Review

No new issues found.

3 unresolved prior findings

⚠️ Review follow-up issue: Unresolved prior review threads: PRRT_kwDOJrNxSs6fEmoG, PRRT_kwDOJrNxSs6fEmoL, PRRT_kwDOJrNxSs6fEmoU.

🤖 Model: claude-opus-5


Review scope: Incremental re-review

Reviewed new changes (4)
  • .env.example
  • README.md
  • src/App.test.tsx
  • src/App.tsx
Previously reviewed and unchanged: 2 files.

@orius123 orius123 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ran the branch locally against a real project and captured the states. Works as documented, spinner shows only with loading=true. 5 comments inline, the timeout one is the only real blocker for me.

Comment thread src/App.tsx Outdated
Comment thread src/App.tsx Outdated
Comment thread src/App.css Outdated
Comment thread src/App.css
Comment thread src/App.test.tsx Outdated
gaokevin1 and others added 3 commits September 15, 2026 08:36
- Dismiss the overlay on a timeout as well as onReady/onError, so a
  blocked CDN no longer leaves an unclickable fixed overlay forever.
  Configurable via the loading_timeout param (seconds) or
  DESCOPE_LOADING_TIMEOUT_MS (ms), default 15s.
- Stop falling back to bg for the spinner color, which rendered a white
  spinner on a white page for bg=ffffff. loading_color or the default.
- Tint the overlay from bg when bg is a color, so dark pages no longer
  flash white for the whole load.
- Respect prefers-reduced-motion for the spinner animation.
- Let the Descope test mock skip onReady, and cover the timeout path.
- Move the loading helpers into src/shared/flowLoading.ts with unit
  tests, and document loading_timeout and the overlay tint.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The spinner put color-mix() inside the border shorthand, so width and
style depended on the color resolving. When color-mix() is unsupported
(the production browserslist still resolves to ios_saf 11 and 15.6-15.8,
and the build does not polyfill it) or the custom property holds a
non-color, the declaration is dropped or invalid at computed-value time
and border-style falls to none, hiding the spinner while the overlay
kept blocking the page. Drop color-mix() from the spinner entirely:
splitting it out is not enough, cssnano merges the longhands back into a
color-bearing shorthand. Only the accent arc reads the custom property
now. The overlay keeps an opaque var() background ahead of its
color-mix() so an unsupported color-mix() no longer leaves an invisible
layer that still swallows clicks.

Validate colors before they reach a custom property. The var() fallback
cannot rescue a property that is set but not to a color, and the old
check only rejected an https:// prefix, so an http:// image URL in
bg/DESCOPE_BG (or any other non-color) was passed straight through. Use
CSS.supports where available and a pattern that still rejects URLs where
it is not, such as jsdom.

Gate the overlay on the domain check as well. FlowGate unmounts the flow
when the domain is not approved, so neither onReady nor onError can
fire, and the overlay sat over the error screen until the timeout.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@shuni-bot

shuni-bot Bot commented Sep 16, 2026

Copy link
Copy Markdown

🐕 Shuni Review

Adds timeout-based dismissal, domain-gate coordination, and configurable loading-overlay colors.

Actionable comments posted: 1

  • 1 🟡 Minor: the overlay’s solid background fallback is lost on browsers without color-mix().

Merge risk: 🟢 Low: a bounded rendering regression affects the loading overlay on older browsers.

See inline comments for details.

🤖 Model: gpt-6-astra · Effort: high


Review scope: Full review

Reviewed files (9)
  • .env.example
  • README.md
  • src/App.css
  • src/App.test.tsx
  • src/App.tsx
  • src/components/FlowGate.tsx
  • src/components/FlowLoadingOverlay.tsx
  • src/shared/flowLoading.test.ts
  • src/shared/flowLoading.ts

🐕 Review complete — View session on Shuni Portal 🐾

🤖 Model: gpt-6-astra · Effort: high

@gaokevin1
gaokevin1 requested a review from orius123 September 16, 2026 17:02

@shuni-bot shuni-bot 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.

🐕 Shuni review: 1 inline finding. Every changed file in this pull request was reviewed.

The full review summary is in Shuni's sticky review comment on this pull request.

Comment thread src/App.css
Comment on lines +102 to +106
background: color-mix(
in srgb,
var(--flow-loading-overlay-color, #ffffff) 88%,
transparent
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick fix

Guard the color-mix() background with a feature query

On Safari versions without color-mix(), the var() in this declaration defers validation until computed-value time. It therefore overrides the preceding solid background before becoming invalid, resetting the background to transparent rather than restoring that fallback. With loading=true, the overlay loses its tint while still intercepting clicks over the visible content. Keep the solid declaration unconditional and place this enhancement inside a top-level @supports (background: color-mix(in srgb, white, transparent)) block; the feature-test value must not contain var().

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