-
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
import React from 'react'; | ||
|
||
import aksjonspunktCodes from '@fpsak-frontend/kodeverk/src/aksjonspunktCodes'; | ||
import vilkarType from '@fpsak-frontend/kodeverk/src/vilkarType'; | ||
import OpptjeningVilkarProsessIndex from '@fpsak-frontend/prosess-vilkar-opptjening-oms'; | ||
import { ProsessStegDef, ProsessStegOverstyringPanelDef, ProsessStegPanelDef } from '@k9-sak-web/behandling-felles'; | ||
import { prosessStegCodes } from '@k9-sak-web/konstanter'; | ||
import aksjonspunktCodes from '@fpsak-frontend/kodeverk/src/aksjonspunktCodes'; | ||
import { ProsessStegDef, ProsessStegPanelDef, ProsessStegOverstyringPanelDef } from '@k9-sak-web/behandling-felles'; | ||
|
||
import OpptjeningVilkarProsessIndexV2 from '@k9-sak-web/gui/prosess/vilkar-opptjening/OpptjeningVilkarProsessIndexV2.js'; | ||
import { konverterKodeverkTilKode } from '@k9-sak-web/lib/kodeverk/konverterKodeverkTilKode.js'; | ||
import { UnntakBehandlingApiKeys } from '../../data/unntakBehandlingApi'; | ||
|
||
class PanelDef extends ProsessStegPanelDef { | ||
getKomponent = props => <OpptjeningVilkarProsessIndex {...props} />; | ||
getKomponent = props => { | ||
if (props.featureToggles.BRUK_V2_VILKAR_OPPTJENING) { | ||
const deepCopyProps = JSON.parse(JSON.stringify(props)); | ||
konverterKodeverkTilKode(deepCopyProps, false); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 FeedbackNegative Feedback |
||
return <OpptjeningVilkarProsessIndexV2 {...props} {...deepCopyProps} />; | ||
} | ||
return <OpptjeningVilkarProsessIndex {...props} />; | ||
}; | ||
|
||
getAksjonspunktKoder = () => [aksjonspunktCodes.VURDER_OPPTJENINGSVILKARET]; | ||
|
||
|
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.