Open
Conversation
08e82ff to
b6f70b8
Compare
b6f70b8 to
17752dc
Compare
This improves the error handling in enterprise util ts when loading the global config json file. Previously the app would experience a blank screen if the file was malformed or missing a closing brace. Key changes: 1. Initialize enterpriseSettings to an empty object to prevent TypeError when reading from it after a parse failure. 2. Add an isReloaded flag to prevent the app from re parsing the filesystem every time a config item is checked. 3. Use a guard to ensure the error dialog is only shown once. Fixes zulip#1404.
17752dc to
c27ad40
Compare
Collaborator
Author
|
Ready for review! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: #1404
This PR improves the error handling and reliability of the enterprise configuration loader in
app/common/enterprise-util.ts. Previously, a malformed or missingglobal_config.jsonfile would cause a TypeError in the renderer process, leading to a permanent blank screen upon application launch.Technical Changes:
Crash Prevention: Initialized
enterpriseSettingsto an empty object{}. This ensures that even if JSON parsing fails, subsequent calls togetConfigItemreturn the provided default value instead of attempting to read fromundefined.Performance Optimization: Added an
isReloadedflag to the configuration loader. This ensures the filesystem is only checked and parsed once during the application's lifecycle, rather than re-reading and re parsing on every configuration check.UI Polish: Implemented an
isErrorShownguard to ensure the "Error loading global_config" native dialog box is only presented once to the user, even if multiple configuration items triggered a reload.Screenshots and screen captures:

Platforms this PR was tested on:
Self-review checklist
(variable names, code reuse, readability, etc.).
Communicate decisions, questions, and potential concerns.
Individual commits are ready for review (see commit discipline).
Completed manual review and testing of the following: