@trackunit/react-form-wizard 1.4.17 → 1.4.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js CHANGED
@@ -381,9 +381,12 @@ const FormWizard = ({ lastStepPrimaryActionLabel, isEdit, steps, fullFormSchema,
381
381
  // If URL does not match a key from the schema, navigate to the first step
382
382
  const firstSchemaKey = String(sharedUtils.objectKeys(fullFormSchema.shape)[0]);
383
383
  const keyToCheck = subStepPath ? `${stepPath}/${subStepPath}` : stepPath;
384
- if (fullFormSchema.shape[keyToCheck] === undefined) {
385
- navigate({ to: basePath, params: { stepPath: firstSchemaKey } });
386
- }
384
+ // Move navigation to useEffect to avoid setState during render
385
+ react.useEffect(() => {
386
+ if (fullFormSchema.shape[keyToCheck] === undefined) {
387
+ navigate({ to: basePath, params: { stepPath: firstSchemaKey } });
388
+ }
389
+ }, [fullFormSchema.shape, keyToCheck, navigate, basePath, firstSchemaKey]);
387
390
  /**
388
391
  * Asserts that step has a shouldRender.
389
392
  * Is a workaround because I can't for the life of me get it to look up the step by a correctly typed
package/index.esm.js CHANGED
@@ -379,9 +379,12 @@ const FormWizard = ({ lastStepPrimaryActionLabel, isEdit, steps, fullFormSchema,
379
379
  // If URL does not match a key from the schema, navigate to the first step
380
380
  const firstSchemaKey = String(objectKeys(fullFormSchema.shape)[0]);
381
381
  const keyToCheck = subStepPath ? `${stepPath}/${subStepPath}` : stepPath;
382
- if (fullFormSchema.shape[keyToCheck] === undefined) {
383
- navigate({ to: basePath, params: { stepPath: firstSchemaKey } });
384
- }
382
+ // Move navigation to useEffect to avoid setState during render
383
+ useEffect(() => {
384
+ if (fullFormSchema.shape[keyToCheck] === undefined) {
385
+ navigate({ to: basePath, params: { stepPath: firstSchemaKey } });
386
+ }
387
+ }, [fullFormSchema.shape, keyToCheck, navigate, basePath, firstSchemaKey]);
385
388
  /**
386
389
  * Asserts that step has a shouldRender.
387
390
  * Is a workaround because I can't for the life of me get it to look up the step by a correctly typed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-form-wizard",
3
- "version": "1.4.17",
3
+ "version": "1.4.19",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "dependencies": {
@@ -10,11 +10,11 @@
10
10
  "react-hook-form": "7.53.1",
11
11
  "@tanstack/react-router": "1.114.29",
12
12
  "@tanstack/router-core": "1.114.29",
13
- "@trackunit/shared-utils": "1.6.9",
14
- "@trackunit/css-class-variance-utilities": "1.4.9",
15
- "@trackunit/react-components": "1.5.15",
16
- "@trackunit/i18n-library-translation": "1.4.11",
17
- "@trackunit/react-test-setup": "1.1.9"
13
+ "@trackunit/shared-utils": "1.6.10",
14
+ "@trackunit/css-class-variance-utilities": "1.4.10",
15
+ "@trackunit/react-components": "1.5.16",
16
+ "@trackunit/i18n-library-translation": "1.4.12",
17
+ "@trackunit/react-test-setup": "1.1.10"
18
18
  },
19
19
  "engines": {
20
20
  "node": ">=22.x",