Conversation
contextual management of Config, decorated pages, and memo components
Greptile SummaryThis PR migrates module-level global registries ( Confidence Score: 5/5Safe to merge — well-tested refactoring with no identified runtime regressions. No P0 or P1 issues found. The only comment is a P2 style suggestion about using reflex/utils/prerequisites.py — Important Files Changed
Sequence DiagramsequenceDiagram
participant T as Test / CLI
participant RC as RegistrationContext
participant CF as config._load_config()
participant AM as App Module
participant AP as App.__init__
T->>RC: RegistrationContext() or fork()
RC-->>T: new context (no _app, no _config)
T->>RC: __enter__ / set()
T->>CF: reload_config()
CF->>CF: acquire _load_config_lock
CF->>CF: sys.modules.pop(rxconfig)
CF->>CF: importlib.import_module(rxconfig)
CF->>RC: ctx._set_config(config)
T->>AM: importlib.reload(app_module)
AM->>AP: rx.App()
AP->>RC: _registration_context._set_app(self)
Note over RC: Guards against second App in same context
AP->>RC: reload_config()
T->>RC: __exit__ / reset(token)
Reviews (3): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile |
Addresses Greptile P2 review comment on #6382. The previous get_config guarded sys.path clear/restore with a module-level RLock; this restores the same protection around _load_config so concurrent calls (e.g. from multiple AppHarness instances or reload_config on background threads) cannot leave sys.path in a corrupt state.
|
@greptile-apps re-review |
Accessing these properties raises a ReflexRuntimeError if the value was None at the time it is accessed. This cleans up LBYL None checking wherever these value are accessed. `RegistrationContext.fork` now does NOT copy the Config, allowing both Config and App to be loaded/reloaded in a forked registration context.
Otherwise the second load causes the RegistrationContext to raise an exception, because _app is already set from the initial load.
|
@greptile-apps re-review |
contextual management of App, Config, decorated pages, and memo components