-
Notifications
You must be signed in to change notification settings - Fork 0
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
v2-versjon av prosess-vilkar-opptjening #7175
base: master
Are you sure you want to change the base?
Conversation
hallvardastark
commented
Mar 6, 2025
•
edited
Loading
edited
- Bytter til react-hook-form
- Modernisert stories
- Fjernet react-intl
- Bruker genererte typescript-typer
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.
PR Overview
This PR introduces a new v2 version of the Opptjening vilkår prosess component by refactoring to use react‐hook‐form, modernizing the story files, and removing react‐intl. Key changes include a complete rewrite of the main component (OpptjeningVilkarProsessIndexV2), new and refactored child components (such as OpptjeningPanel, VilkarField, and OpptjeningVilkarAksjonspunktPanel), and updates to various panel definition files and deployment configurations to integrate the new version.
Reviewed Changes
File | Description |
---|---|
packages/v2/gui/src/prosess/vilkar-opptjening/OpptjeningVilkarProsessIndexV2.tsx | New v2 main component implementation using react‐hook‐form and updated hooks. |
packages/v2/gui/src/prosess/vilkar-opptjening/components/OpptjeningPanel.tsx | Modernized panel component using updated design tokens and structure. |
packages/v2/gui/src/prosess/vilkar-opptjening/components/VilkarField.tsx | Revised validation logic and layout in the vilkår input field. |
packages/v2/gui/src/prosess/vilkar-opptjening/components/OpptjeningVilkarAksjonspunktPanel.tsx | Added comprehensive form handling and value transformation logic. |
Various panel definition files (in behandling-unntak, behandling-omsorgspenger, behandling-opplaeringspenger, behandling-pleiepenger, etc.) | Integrated the new v2 component conditionally using feature toggles and deep copying/conversion of props. |
_mocks/featureToggles.ts & deploy configuration files | Added and enabled the BRUK_V2_VILKAR_OPPTJENING feature toggle in local and deployment environments. |
Copilot reviewed 38 out of 38 changed files in this pull request and generated 2 comments.
getKomponent = props => <OpptjeningVilkarProsessIndex {...props} />; | ||
getKomponent = props => { | ||
if (props.featureToggles.BRUK_V2_VILKAR_OPPTJENING) { | ||
const deepCopyProps = JSON.parse(JSON.stringify(props)); |
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.
Using JSON.parse(JSON.stringify(props)) for deep cloning may lead to performance issues or unexpected behavior with complex data types. Consider using a dedicated deep clone utility (e.g. lodash's cloneDeep) to ensure robustness.
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
getKomponent = props => <OpptjeningVilkarProsessIndex {...props} />; | ||
getKomponent = props => { | ||
if (props.featureToggles.BRUK_V2_VILKAR_OPPTJENING) { | ||
const deepCopyProps = JSON.parse(JSON.stringify(props)); |
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 deep cloning of props using JSON.parse(JSON.stringify(props)) is used here as well, which can be inefficient and error-prone with non-serializable values. It is recommended to use a specialized deep cloning function to improve reliability.
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.