-
Notifications
You must be signed in to change notification settings - Fork 350
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
Bare bones feature flags app. Human edits, reads over API #170
base: main
Are you sure you want to change the base?
Conversation
if self.feature_flags_as_loaded_from_db is None: | ||
self.load_feature_flags_from_db() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
side effects not advised in computed var
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intent is a "cached property". I.e. load stuff from DB if never loaded before. What would be a better pattern?
E.g. is there logic I can attach to "initialization" of the state?
new_flag_modal_is_open: bool = False | ||
new_flag_modal_error: Optional[str] = None | ||
|
||
new_flag_modal_flag_name: Optional[str] = "" | ||
new_flag_modal_flag_value: Optional[str] = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think the modal-related stuff should go into a substate, then you also wouldn't need reset_new_flag_modal_state
, since you could just call self.reset()
and use the builtin method if the substate only contained items related to the modal.
rx.modal_body( | ||
"Add a new feature flag", | ||
rx.hstack( | ||
rx.input(value=FeatureFlagsState.new_flag_modal_flag_name, width='30%', | ||
on_change=FeatureFlagsState.set_new_flag_modal_flag_name), | ||
rx.input(value=FeatureFlagsState.new_flag_modal_flag_value, | ||
on_change=FeatureFlagsState.set_new_flag_modal_flag_value, | ||
width='70%')), | ||
rx.cond(FeatureFlagsState.new_flag_modal_error, | ||
rx.text(FeatureFlagsState.new_flag_modal_error, color="red")) | ||
), | ||
rx.modal_footer( | ||
rx.button( | ||
"Stage", on_click=FeatureFlagsState.new_flag_modal_stage, | ||
), | ||
rx.button( | ||
"Cancel", on_click=FeatureFlagsState.new_flag_modal_cancel, | ||
) | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
possibly a bit nicer to use an rx.form
here as then you get <enter>
key functionality automatically and don't need to use controlled inputs
TODO: add README
Spell out DB migrations... plus DB_URL for "production" (lol) use.