fix: fix data dictionary basiccell component to render boolean values as string (#474)#475
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes the rendering issue for boolean values in the DataDictionary BasicCell component and improves type safety by introducing a dedicated value parsing utility.
- Refactors BasicCell to extend the TValue type parameter (defaulting to ReactNode)
- Introduces and integrates the parseValue utility for consistent value transformation
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/components/DataDictionary/components/Table/components/BasicCell/utils.ts | Added parseValue utility to handle boolean-to-string conversion |
| src/components/DataDictionary/components/Table/components/BasicCell/basicCell.tsx | Updated BasicCell to use parseValue instead of casting the value directly |
Comments suppressed due to low confidence (1)
src/components/DataDictionary/components/Table/components/BasicCell/utils.ts:9
- [nitpick] Consider adding unit tests for parseValue to verify its behavior with various ReactNode types, ensuring consistent rendering for non-boolean values in future updates.
if (typeof value === "boolean") return value.toString();
NoopDog
approved these changes
May 13, 2025
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.
Closes #474.
This pull request refactors the
BasicCellcomponent in theDataDictionarytable to improve type safety and enhance value rendering. The main changes include extending theBasicCellcomponent's type definitions and introducing a utility function to handle value parsing.Changes to
BasicCellcomponent:BasicCellcomponent to extend theTValuetype parameter, defaulting it toReactNode, for improved type safety and flexibility. (src/components/DataDictionary/components/Table/components/BasicCell/basicCell.tsx, src/components/DataDictionary/components/Table/components/BasicCell/basicCell.tsxR5-R17)parseValueutility function for consistent handling of different value types. (src/components/DataDictionary/components/Table/components/BasicCell/basicCell.tsx, src/components/DataDictionary/components/Table/components/BasicCell/basicCell.tsxR5-R17)Addition of
parseValueutility:parseValuefunction to handle special cases, such as converting boolean values to strings, ensuring consistent rendering of cell values. (src/components/DataDictionary/components/Table/components/BasicCell/utils.ts, src/components/DataDictionary/components/Table/components/BasicCell/utils.tsR1-R11)