fleet
fleet copied to clipboard
Review frontend usage of `normalizeEmptyValues()`
On the HostDetailsPage and DeviceUserPage we're using a function called normalizeEmptyValues() to normalize the object we're displaying. The problem with this function is that we're losing all typing on the resulting object. Typescript thinks every property is a string, regardless of what it actually is, which is causing problems further down the line.
I'm starting this thread so we can identify the benefit of using normalizeEmptyValues() (why it was implemented) and work out a solution that will allow us to keep proper interfaces on these pages.
@fleetdm/frontend Would y'all please take a look at this? I'm curious if anyone recalls why the noramlizeEmptyValues() function was added, and if we can brainstorm an approach that doesn't lose typing.
I'm afraid younger me was responsible for this.
We should definitely rework our approach. I'll take a closer look and follow up with more comments.
Sounds good, thanks for the audit trail!
So looks like the purpose of the normalization function is to replace any falsey values with ---. However, that introduces typing mismatches that are causing issues.
@ghernandez345 This came up on recent work to the Host details page. Going to add this to our frontend sync agenda