Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

forced boolean type for beacon_ui_enabled #188

Merged
merged 7 commits into from
Oct 1, 2024

Conversation

SanjeevLakhwani
Copy link
Contributor

No description provided.

Copy link
Member

@gsfk gsfk left a comment

Choose a reason for hiding this comment

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

Beacon on/off works as expected but I find this fix confusing.

For me the expected fix was to keep BEACON_UI_ENABLED as a boolean everywhere, and wrap only process.env.BENTO_BEACON_UI_ENABLED in stringToBoolean(), ie:

BEACON_UI_ENABLED = BENTO_PUBLIC_CONFIG.BEACON_UI_ENABLED ?? stringToBoolean(process.env.BENTO_BEACON_UI_ENABLED);

.. ie you cast to boolean when you first see the value, instead of passing the string along. Otherwise you get a confusing situation where

BENTO_PUBLIC_CONFIG.BEACON_UI_ENABLED is a string
BEACON_UI_ENABLED is a boolean

Note that there is another boolean in config (TRANSLATED) that probably has similar issues.

(also, possibly beyond the scope of this pr, why are there two values with the same name? Why do we export a separate BEACON_UI_ENABLED variable instead of simply exporting the config object?)

Another issue that's probably not specific to this pr is the expected behaviour when asking for routes that don't exist (like asking for /beacon on an instance with beacon turned off): previously if you asked for a non-existent route, you would be returned to the default page (Overview), now you just get a white screen... not a crash, just ... nothing...

src/js/config.ts Outdated Show resolved Hide resolved
@gsfk gsfk self-requested a review September 25, 2024 17:57
Copy link
Member

@davidlougheed davidlougheed left a comment

Choose a reason for hiding this comment

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

create_config_prod is made to be ran separate from typescript, and so it should not include any code from src/ - keep a separate definition inside create_config_prod.js

Copy link
Member

@davidlougheed davidlougheed left a comment

Choose a reason for hiding this comment

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

make parseBoolean in create_config_prod check the same values as stringToBoolean in utils/strings

@davidlougheed davidlougheed merged commit bce2ae2 into main Oct 1, 2024
2 checks passed
@davidlougheed davidlougheed deleted the bugfiz/2318-fix-boolean-type branch October 1, 2024 15:21
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