@stoker-platform/web-app 0.5.228 → 0.5.230
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/CHANGELOG.md +14 -0
- package/package.json +3 -3
- package/src/Form.tsx +17 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @stoker-platform/web-app
|
|
2
2
|
|
|
3
|
+
## 0.5.230
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix: refresh form state from server after successful save
|
|
8
|
+
|
|
9
|
+
## 0.5.229
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
- @stoker-platform/node-client@0.5.90
|
|
15
|
+
- @stoker-platform/web-client@0.5.95
|
|
16
|
+
|
|
3
17
|
## 0.5.228
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stoker-platform/web-app",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.230",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"scripts": {
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
52
52
|
"@react-google-maps/api": "^2.20.8",
|
|
53
53
|
"@sentry/react": "^10.56.0",
|
|
54
|
-
"@stoker-platform/node-client": "0.5.
|
|
54
|
+
"@stoker-platform/node-client": "0.5.90",
|
|
55
55
|
"@stoker-platform/utils": "0.5.79",
|
|
56
|
-
"@stoker-platform/web-client": "0.5.
|
|
56
|
+
"@stoker-platform/web-client": "0.5.95",
|
|
57
57
|
"@tanstack/react-table": "^8.21.3",
|
|
58
58
|
"@types/react": "18.3.13",
|
|
59
59
|
"@types/react-dom": "18.3.1",
|
package/src/Form.tsx
CHANGED
|
@@ -2474,6 +2474,10 @@ function RecordForm({
|
|
|
2474
2474
|
|
|
2475
2475
|
const formValues = form.watch()
|
|
2476
2476
|
const [prevState, setPrevState] = useState<Partial<StokerRecord>>({} as Partial<StokerRecord>)
|
|
2477
|
+
const prevStateRef = useRef<Partial<StokerRecord>>(prevState)
|
|
2478
|
+
useEffect(() => {
|
|
2479
|
+
prevStateRef.current = prevState
|
|
2480
|
+
}, [prevState])
|
|
2477
2481
|
const [originalRecord, setOriginalRecord] = useState<StokerRecord | undefined>(undefined)
|
|
2478
2482
|
const [formResetKey, setFormResetKey] = useState(0)
|
|
2479
2483
|
const [formSavedKey, setFormSavedKey] = useState(0)
|
|
@@ -3235,6 +3239,19 @@ function RecordForm({
|
|
|
3235
3239
|
key.startsWith("accessible-"),
|
|
3236
3240
|
),
|
|
3237
3241
|
)
|
|
3242
|
+
if (!initial) {
|
|
3243
|
+
const currentValues = form.getValues()
|
|
3244
|
+
for (const [key, value] of Object.entries(filteredRecord)) {
|
|
3245
|
+
if (
|
|
3246
|
+
// eslint-disable-next-line security/detect-object-injection
|
|
3247
|
+
isEqual(currentValues[key], prevStateRef.current?.[key]) &&
|
|
3248
|
+
// eslint-disable-next-line security/detect-object-injection
|
|
3249
|
+
!isEqual(currentValues[key], value)
|
|
3250
|
+
) {
|
|
3251
|
+
form.setValue(key, value)
|
|
3252
|
+
}
|
|
3253
|
+
}
|
|
3254
|
+
}
|
|
3238
3255
|
setPrevState({ ...prevState, ...permissionValues })
|
|
3239
3256
|
}
|
|
3240
3257
|
},
|