Skip to content
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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

hallvardastark
Copy link
Collaborator

@hallvardastark hallvardastark commented Mar 6, 2025

  • Bytter til react-hook-form
  • Modernisert stories
  • Fjernet react-intl
  • Bruker genererte typescript-typer

@hallvardastark hallvardastark requested a review from a team as a code owner March 6, 2025 12:42
@hallvardastark hallvardastark requested a review from Copilot March 11, 2025 10:06
Copy link

@Copilot Copilot AI left a 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));
Copy link
Preview

Copilot AI Mar 11, 2025

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.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
getKomponent = props => <OpptjeningVilkarProsessIndex {...props} />;
getKomponent = props => {
if (props.featureToggles.BRUK_V2_VILKAR_OPPTJENING) {
const deepCopyProps = JSON.parse(JSON.stringify(props));
Copy link
Preview

Copilot AI Mar 11, 2025

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.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
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.

1 participant