Skip to content

Conversation

@thabofletcher
Copy link
Contributor

@thabofletcher thabofletcher commented Dec 3, 2025

Ticket ENG-2122

Description Of Changes

Small fix in an attempt to prevent a white screen on CN in the mobile SDK

Code Changes

  • More explicit false check to avoid loading states - the theory is:
    The bug:
    disableBanner starts as null
    The delay banner effect checks if (!disableBanner)
    !null === true in JavaScript
    If the 100ms timeout fires before disableBanner is updated from null to true, it calls setBannerIsOpen(true)
    In embedded mode, bannerIsOpen === true causes ConsentContent to be replaced with null (line 293)
    White screen!
  • add comment to make sure a key element remains unchanged in FidesJS

Steps to Confirm

  1. No testing needed, regression tests cover

Pre-Merge Checklist

  • Issue requirements met
  • All CI pipelines succeeded
  • CHANGELOG.md updated
    • Add a db-migration This indicates that a change includes a database migration label to the entry if your change includes a DB migration
    • Add a high-risk This issue suggests changes that have a high-probability of breaking existing code label to the entry if your change includes a high-risk change (i.e. potential for performance impact or unexpected regression) that should be flagged
    • Updates unreleased work already in Changelog, no new entry necessary
  • UX feedback:
    • All UX related changes have been reviewed by a designer
    • No UX review needed
  • Followup issues:
    • Followup issues created
    • No followup issues
  • Database migrations:
    • Ensure that your downrev is up to date with the latest revision on main
    • Ensure that your downgrade() migration is correct and works
      • If a downgrade migration is not possible for this change, please call this out in the PR description!
    • No migrations
  • Documentation:
    • Documentation complete, PR opened in fidesdocs
    • Documentation issue created in fidesdocs
    • If there are any new client scopes created as part of the pull request, remember to update public-facing documentation that references our scope registry
    • No documentation updates required

…bedded mode

The delay banner effect used `!disableBanner` to check if the banner should
open. Since `disableBanner` starts as `null`, and `!null === true` in
JavaScript, if the 100ms timeout fired before the state was updated from
`null` to `true`, it would incorrectly call `setBannerIsOpen(true)`.

In embedded mode, setting `bannerIsOpen` to `true` causes the ConsentContent
to be replaced with `null`, resulting in a white screen. This was more likely
to occur on mobile devices with slower JavaScript execution.

The fix uses an explicit `=== false` check to ensure the banner only opens
when we've definitively determined it should (not when still initializing).
@thabofletcher thabofletcher requested a review from a team as a code owner December 3, 2025 18:57
@thabofletcher thabofletcher requested review from jpople and removed request for a team December 3, 2025 18:57
@vercel
Copy link

vercel bot commented Dec 3, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
fides-plus-nightly Ignored Ignored Dec 3, 2025 6:57pm
fides-privacy-center Ignored Ignored Dec 3, 2025 6:57pm

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 3, 2025

Greptile Overview

Greptile Summary

Fixed a race condition in the consent banner that could cause a white screen in embedded mode on mobile SDK. The issue occurred when disableBanner was still null during the 100ms delay, causing !null === true to incorrectly trigger setBannerIsOpen(true), which would then render null instead of consent content in embedded mode.

Key changes:

  • Changed condition from if (!disableBanner) to if (disableBanner === false) to explicitly check for false value
  • Added documentation comment warning not to change fides-button-group ID without coordinating with mobile SDK team

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The fix is a simple, well-understood logic change that correctly handles the three-state nature of the disableBanner variable (null, true, false). The change is surgical, well-commented, and directly addresses the root cause of the race condition. The documentation comment addition is also a low-risk improvement that prevents future breaking changes.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
clients/fides-js/src/components/ConsentButtons.tsx 5/5 Added documentation comment to prevent breaking changes to fides-button-group ID used by mobile SDK
clients/fides-js/src/components/Overlay.tsx 5/5 Fixed race condition with explicit false check for disableBanner to prevent white screen in embedded mode

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

Copy link
Contributor

@gilluminate gilluminate left a comment

Choose a reason for hiding this comment

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

Makes sense

@thabofletcher thabofletcher added this pull request to the merge queue Dec 3, 2025
@thabofletcher thabofletcher removed the request for review from jpople December 3, 2025 19:11
Merged via the queue into main with commit b90d86d Dec 3, 2025
43 checks passed
@thabofletcher thabofletcher deleted the ENG-2122-embedded-consent-mobile-fixes branch December 3, 2025 19:22
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.

3 participants