Skip to content

Conversation

@KeeyanGhoreshi
Copy link

This does not necessarily need to be pulled in, but could help address problems with our settings. One issue we have is that we define the settings in two places, once in data.js as a definition, and then again in the RequestBuilder's state. This produces the potential for a bug where the values between the two are mismatched, and since the SettingsBox only looks at the headerDefinitions, then tries to set the state, it could end up setting the state for a non-existent value. This error would not produce an exception and the program would just appear to not work for no reason, making this a dangerous possible error.

The solution is to define one "source of truth" which I've done by pushing the headerDefinitions all into data.js, which RequestBuilder now uses to define its state. The downside of this is that the RequestBuilder's state is now built dynamically, and can't be referenced directly (by intellisense, for example) meaning you might not know what exactly is in the state when programming. A bug here WOULD produce an error, however, so it's easily detectable.

In an idealized version of this fix, the state would hold its own definition of its settings, which would be passed to settingsBox as a prop, which would then render them. This would require a bit of work, however, to restructure how the app uses and updates its settings, as well as how SettingsBox renders it.

I don't think it's worth the effort to do all that, though. In fact, even this change might not be worth it, given that it makes things less convenient in return for solving an issue that's very unlikely to occur.

Copy link

@plarocque4 plarocque4 left a comment

Choose a reason for hiding this comment

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

Looks good

@plarocque4 plarocque4 merged commit fadeef7 into settings-modal Feb 1, 2024
@plarocque4 plarocque4 deleted the fix-settings branch February 1, 2024 20:47
plarocque4 pushed a commit that referenced this pull request Feb 8, 2024
* make settings a modal and add save button

* remove potential for uncaught mismatch (#97)

* fix checkboxes

* fix issue with patient load
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