Skip to content

Conversation

stigus
Copy link
Contributor

@stigus stigus commented Apr 30, 2025

No description provided.

stigus added 21 commits April 25, 2025 11:11
Re-enabled `babel-plugin-react-compiler` now that it is stable. Updated various dependencies, including `babel-plugin-react-compiler` to version 19.1.0-rc.1 and other packages like `@esbuild` to address minor version updates and improve compatibility.
… nå vises den som låst med en gang dersom kallet gikk gjennom

#deploy-test-frontend
# Conflicts:
#	apps/dolly-frontend/src/main/js/package-lock.json
… not being shown

- Playwright test refactor for less flakiness
- Updates
#deploy-test-frontend
#deploy-test-frontend
# Conflicts:
#	apps/dolly-frontend/src/main/js/__tests__/mocks/mockServiceWorker.js
#	apps/dolly-frontend/src/main/js/package-lock.json
#	apps/dolly-frontend/src/main/js/package.json
#	apps/dolly-frontend/src/main/js/playwright/mocks/Selectors.tsx
#	apps/dolly-frontend/src/main/js/playwright/tests/Identvisning.spec.ts
…yTextInput` in all usages.

- Delete obsolete `ui-demo` page and related styles.
- Convert `Form` to `form` tag in `RedigerGruppe` for React Hook Form v7 compatibility.
- Refactor `Attributt` and `AttributtKategori` components with improved state and visibility handling.
- Add utility typings for attributes and batch operations.
- Enhance test `Identvisning.spec` with refined assertions and timeouts.
- Update `Panel` component to address environment-dependent operations and batch actions.
- Bump `mockServiceWorker` to v2.10.5 and update dependencies (`css-tools` -> v4.4.4).

#deploy-test-frontend
… with `useCallback` and utility typings.

- Update `Panel.tsx` for simplified structure, environment-aware error handling, and streamlined batch operation actions.
- Bump version to `3.1.10` in `package.json` and related lock file updates.
- Upgrade several dependencies, including `@babel` and `fdir`, for improved tooling compatibility.

#deploy-test-frontend
…readability and enhance state handling.

- Add `AttributtKategori.tsx` as a new file to streamline attribute categorization logic.
- Optimize `Steg1Person`, `Steg1Organisasjon`, and panels for modularity with `useMemo` and improved type support.
- Simplify and update `stateModifier` with cleaner typings and helper abstractions for better reusability.
- Enhance components for user efficiency, resolving redundant operations and UI inconsistencies.

#deploy-test-frontend
…ed typing, visibility logic, and cleaner JSX structure.

- Update `stateModifier` with streamlined field resetting, checked attributes handling, and better form value updates.
- Add interfaces for props, ensure type safety, and skip compilation for specific memo hooks.

#deploy-test-frontend
…nts for improved structure.

- Add controlled input behavior with `useControlled` in `Personinformasjon` component.
- Introduce `useEffect` with reset logic for auto-reset functionality in `Personinformasjon`.
- Remove unnecessary use of `useFormContext` in `Identifikasjon`.
- Update dependency versions, including `react-pdf` to `10.1.0`.
- Bump project version to `3.2.0` in `package.json` and `package-lock.json`.

#deploy-test-frontend
# Conflicts:
#	apps/dolly-frontend/src/main/js/package-lock.json
#	apps/dolly-frontend/src/main/js/package.json
….json`.

- Update dependencies, including `react-pdf` to `10.1.0`, `@babel` packages to `7.28.4`, and other related libraries.
- Remove obsolete `@ampproject/remapping` and `@bundled-es-modules/tough-cookie` dependencies.
- Add optional dependency `@napi-rs/canvas` for enhanced canvas support.

#deploy-test-frontend
@stigus stigus marked this pull request as ready for review September 9, 2025 11:44
@Copilot Copilot AI review requested due to automatic review settings September 9, 2025 11:44
@stigus stigus requested a review from a team as a code owner September 9, 2025 11:44
Copy link
Contributor

@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.

Pull Request Overview

This PR migrates the frontend to use the React Compiler by enabling the babel-plugin-react-compiler plugin and makes various code adjustments for compatibility. The main purpose is to enhance React performance through automatic memoization and optimization.

  • Enable React Compiler plugin in Vite configuration with target React 19
  • Update form components and input handling for React Compiler compatibility
  • Refactor import paths from SoekForm to SoekFormWrapper across multiple files

Reviewed Changes

Copilot reviewed 39 out of 41 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
vite.config.js Enable React Compiler babel plugin with React 19 target
Multiple soekFormPartials files Update import paths from SoekForm to SoekFormWrapper
Checkbox.tsx Refactor checkbox components with proper TypeScript types and forwardRef
TextInput.tsx Remove FormFieldInput component and consolidate to DollyTextInput
index.tsx Add React.StrictMode wrapper for better development checks
Personinformasjon.tsx Add type assertions and useControlled prop for form inputs
Various other files Minor updates for React Compiler compatibility
Files not reviewed (1)
  • apps/dolly-frontend/src/main/js/package-lock.json: Language not supported

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

size="small"
placeholder="Velg kjønn ..."
onChange={(val: SyntheticEvent) => handleChange(val?.value || null, 'kjoenn')}
onChange={(val: SyntheticEvent) => handleChange((val as any)?.value || null, 'kjoenn')}
Copy link
Preview

Copilot AI Sep 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using 'as any' type assertion bypasses TypeScript's type safety. Consider defining a proper interface for the select value or using a more specific type assertion like 'as {value: string}'.

Copilot uses AI. Check for mistakes.

/>
<FormTextInput
name={`${personPath}.alderFom`}
useControlled={true}
Copy link
Preview

Copilot AI Sep 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'useControlled={true}' prop suggests this component is switching between controlled and uncontrolled modes. This pattern can cause React warnings and unexpected behavior. Consider consistently using controlled components throughout the form.

Suggested change
useControlled={true}

Copilot uses AI. Check for mistakes.

import { BestillingsveilederContext, BestillingsveilederContextType } from './BestillingsveilederContext'
import * as _ from 'lodash-es'

export const useStateModifierFns = (formMethods: UseFormReturn, setFormMutate: any) => {
Copy link
Preview

Copilot AI Sep 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'use no memo' directive and its purpose should be documented more clearly. Consider adding a comment explaining why React Compiler optimization is being skipped for this specific component.

Suggested change
export const useStateModifierFns = (formMethods: UseFormReturn, setFormMutate: any) => {
export const useStateModifierFns = (formMethods: UseFormReturn, setFormMutate: any) => {
// React Compiler optimization is skipped for this hook because it relies on dynamic form state,
// mutable context, and side effects that are not compatible with automatic memoization.
// Ensuring up-to-date values and correct behavior requires disabling memoization here.

Copilot uses AI. Check for mistakes.

…nges and add `requestInterceptedAt` timestamp for improved request tracking.

- Remove unused `MOCK_DEACTIVATE` handler from `mockServiceWorker.js`.
- Upgrade dependency versions, including:
  - `@navikt/aksel-icons`, `@navikt/ds-css`, `@navikt/ds-react`, `@navikt/ds-tokens` to `7.30.0`.
  - `@jridgewell/trace-mapping` to `0.3.31`.
  - `country-data-list` to `1.5.5`.
  - `electron-to-chromium` to `1.5.217`.
  - `rettime` (new dependency) to `0.7.0`.
  - `zimmerframe` to `1.1.4`.

#deploy-test-frontend
# Conflicts:
#	apps/dolly-frontend/src/main/js/__tests__/mocks/mockServiceWorker.js
#	apps/dolly-frontend/src/main/js/package-lock.json
#	apps/dolly-frontend/src/main/js/package.json
#	apps/dolly-frontend/src/main/js/src/pages/dollySoek/SoekForm.tsx
#	apps/dolly-frontend/src/main/js/src/pages/dollySoek/soekFormPartials/Identifikasjon.tsx
#	apps/dolly-frontend/src/main/js/src/pages/dollySoek/soekFormPartials/Personinformasjon.tsx
#	apps/dolly-frontend/src/main/js/src/pages/tenorSoek/soekFormPartials/FolkeregisteretStatsborgerskap.tsx
…r consistent controlled input behavior.

- Remove redundant `useControlled` prop declarations from `DollyTextInput` components.
- Clean up console log statement in `RedigerGruppe.tsx`.

#deploy-test-frontend
stigus added 6 commits October 3, 2025 14:46
…s and reset form state correctly.

- Integrate `ToastContainer`, `ErrorToast`, and `SuccessToast` for improved user feedback on form submissions.
- Update `ErrorToast` to display error messages using `useEffect`.
- Modify `GruppeHeader` to handle optional chaining for `brukertype` and improve tag display logic.
- Enhance `LaasButton` and `SlettButton` to support optional auto mutation after actions.
#deploy-test-frontend
…tional parameter for fetching future messages.

- Modify `InformasjonsmeldingRepository` to rename `findGyldigMeldinger` to `findGjeldendeMeldinger` and add a new method `findGjeldendeOgFremtidigeMeldinger`.
#deploy-test-dolly-backend
…cluding future messages.

- Modify data fetching logic to use a dynamic URL based on the new parameter.
- Ensure revalidation of both current and future infostriper data after create, update, and delete operations.
- Adjust `DollyInfostripePage` to pass the new parameter to `useDollyInfostriper`.
- Add consistent styling to `ActionMenu.Divider` for better UI spacing.

#deploy-test-frontend
- Update `@eslint/config-helpers` to version 0.4.0
- Update `@eslint/core` to version 0.16.0
- Update `@eslint/js` to version 9.37.0
- Update `@eslint/plugin-kit` to version 0.4.0
- Update `@types/node` to version 24.7.0
- Update `baseline-browser-mapping` to version 2.8.12
- Update `caniuse-lite` to version 1.0.30001748
- Update `dot-prop` to version 10.1.0
- Update `electron-to-chromium` to version 1.5.230
- Update `eslint` to version 9.37.0
- Update `node-releases` to version 2.0.23
- Update `react-hook-form` to version 7.64.0
- Update `undici-types` to version 7.14.0

#deploy-test-frontend
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