Skip to content

remove toaster outside of radix#5827

Merged
adhami3310 merged 2 commits intomainfrom
fix-toaster-inside-of-radix
Oct 2, 2025
Merged

remove toaster outside of radix#5827
adhami3310 merged 2 commits intomainfrom
fix-toaster-inside-of-radix

Conversation

@adhami3310
Copy link
Member

No description provided.

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.

Greptile Overview

Summary

This PR refactors the app wrapper component hierarchy by moving the ToasterProvider outside of radix components. The key changes are:

  • ToasterProvider priority changed: Priority moved from (1, "ToasterProvider") to (44, "ToasterProvider"), effectively moving it lower in the component hierarchy so it wraps outside of radix components rather than inside
  • Code refactoring: The _app_root method was refactored to use functools.reduce instead of a simple loop for building the component hierarchy, making the code more functional

The refactoring maintains the same functionality while improving the component wrapping order and code style.

Confidence Score: 4/5

  • This PR is safe to merge with minimal risk
  • Score reflects clean refactoring with clear intent - moving ToasterProvider outside radix components is a reasonable architectural change, and the functools.reduce refactoring improves code style without changing functionality
  • No files require special attention

Important Files Changed

File Analysis

Filename        Score        Overview
reflex/app.py 4/5 Refactored app wrapper ordering logic using functools.reduce and moved ToasterProvider to lower priority (44)

Sequence Diagram

sequenceDiagram
    participant App as App._app_root()
    participant Components as app_wrappers
    participant Reduce as functools.reduce
    participant ToasterProvider as ToasterProvider

    Note over App: Before: Priority (1, "ToasterProvider")
    Note over App: After: Priority (44, "ToasterProvider")

    App->>Components: Get all app_wrappers
    App->>App: Sort by priority (reverse=True)
    
    Note over App: Old approach: Simple loop
    Note over App: New approach: functools.reduce
    
    App->>App: Create root from highest priority wrapper
    App->>Reduce: Apply reducer function to remaining wrappers
    loop For each wrapper in order[1:]
        Reduce->>Reduce: reducer(parent, key)
        Note over Reduce: child = copy.deepcopy(app_wrappers[key])
        Note over Reduce: parent.children.append(child)
        Note over Reduce: return child as new parent
    end
    
    Note over ToasterProvider: ToasterProvider now wraps at priority 44
    Note over ToasterProvider: (lower in hierarchy, outside radix components)
    
    App->>App: Return root component
Loading

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@codspeed-hq
Copy link

codspeed-hq bot commented Sep 25, 2025

CodSpeed Performance Report

Merging #5827 will not alter performance

Comparing fix-toaster-inside-of-radix (4975f5f) with main (269723b)

Summary

✅ 8 untouched

@masenf
Copy link
Collaborator

masenf commented Sep 26, 2025

conceptually good, need to fix tests

@adhami3310 adhami3310 merged commit 42e77b1 into main Oct 2, 2025
41 checks passed
@adhami3310 adhami3310 deleted the fix-toaster-inside-of-radix branch October 2, 2025 15:50
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