@stoker-platform/web-app 0.5.237 → 0.5.238
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 +11 -0
- package/package.json +4 -4
- package/src/Form.tsx +42 -15
- package/src/Login.tsx +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @stoker-platform/web-app
|
|
2
2
|
|
|
3
|
+
## 0.5.238
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix: improve form dirty state check
|
|
8
|
+
- fix: show errors on create form for server writes
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
- @stoker-platform/utils@0.5.84
|
|
11
|
+
- @stoker-platform/node-client@0.5.97
|
|
12
|
+
- @stoker-platform/web-client@0.5.101
|
|
13
|
+
|
|
3
14
|
## 0.5.237
|
|
4
15
|
|
|
5
16
|
### 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.238",
|
|
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.
|
|
55
|
-
"@stoker-platform/utils": "0.5.
|
|
56
|
-
"@stoker-platform/web-client": "0.5.
|
|
54
|
+
"@stoker-platform/node-client": "0.5.97",
|
|
55
|
+
"@stoker-platform/utils": "0.5.84",
|
|
56
|
+
"@stoker-platform/web-client": "0.5.101",
|
|
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
|
@@ -78,6 +78,7 @@ import { removeEmptyStrings } from "./utils/removeEmptyStrings"
|
|
|
78
78
|
import { useGlobalLoading } from "./providers/LoadingProvider"
|
|
79
79
|
import {
|
|
80
80
|
deleteField,
|
|
81
|
+
FieldValue,
|
|
81
82
|
doc,
|
|
82
83
|
collection as dbCollection,
|
|
83
84
|
Timestamp,
|
|
@@ -3246,10 +3247,19 @@ function RecordForm({
|
|
|
3246
3247
|
if (id) {
|
|
3247
3248
|
if (!initial) {
|
|
3248
3249
|
const relationFields = getRelationFields(collection)
|
|
3249
|
-
|
|
3250
|
+
const getOneOptions = {
|
|
3250
3251
|
noEmbeddingFields: true,
|
|
3251
3252
|
relations: { fields: relationFields, depth: 1 },
|
|
3252
|
-
}
|
|
3253
|
+
}
|
|
3254
|
+
if (serverWriteOnly) {
|
|
3255
|
+
try {
|
|
3256
|
+
record = await getOne(path, id, { ...getOneOptions, only: "server" })
|
|
3257
|
+
} catch {
|
|
3258
|
+
record = await getOne(path, id, getOneOptions)
|
|
3259
|
+
}
|
|
3260
|
+
} else {
|
|
3261
|
+
record = await getOne(path, id, getOneOptions)
|
|
3262
|
+
}
|
|
3253
3263
|
}
|
|
3254
3264
|
if (!record) return
|
|
3255
3265
|
const originalRecord = cloneDeep(record)
|
|
@@ -3953,10 +3963,10 @@ function RecordForm({
|
|
|
3953
3963
|
}
|
|
3954
3964
|
if (isRelationField(field)) {
|
|
3955
3965
|
if (valuesClone[field.name]) {
|
|
3956
|
-
valuesClone[field.name] = Object.keys(valuesClone[field.name])
|
|
3966
|
+
valuesClone[field.name] = Object.keys(valuesClone[field.name]).sort()
|
|
3957
3967
|
}
|
|
3958
3968
|
if (prevStateClone[field.name]) {
|
|
3959
|
-
prevStateClone[field.name] = Object.keys(prevStateClone[field.name])
|
|
3969
|
+
prevStateClone[field.name] = Object.keys(prevStateClone[field.name]).sort()
|
|
3960
3970
|
}
|
|
3961
3971
|
}
|
|
3962
3972
|
if (field.type === "Computed") {
|
|
@@ -4320,18 +4330,22 @@ function RecordForm({
|
|
|
4320
4330
|
})
|
|
4321
4331
|
.catch((error) => {
|
|
4322
4332
|
console.error(error)
|
|
4323
|
-
if (
|
|
4324
|
-
|
|
4325
|
-
description: error.message.replace("VALIDATION_ERROR: ", ""),
|
|
4326
|
-
variant: "destructive",
|
|
4327
|
-
duration: 10000000,
|
|
4328
|
-
})
|
|
4333
|
+
if (isServerReadOnly || serverWrite) {
|
|
4334
|
+
setError(error.message.replace("VALIDATION_ERROR: ", ""))
|
|
4329
4335
|
} else {
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4336
|
+
if (error.message.includes("VALIDATION_ERROR")) {
|
|
4337
|
+
toast({
|
|
4338
|
+
description: error.message.replace("VALIDATION_ERROR: ", ""),
|
|
4339
|
+
variant: "destructive",
|
|
4340
|
+
duration: 10000000,
|
|
4341
|
+
})
|
|
4342
|
+
} else {
|
|
4343
|
+
toast({
|
|
4344
|
+
// eslint-disable-next-line security/detect-object-injection
|
|
4345
|
+
description: `${recordTitle} ${values[recordTitleField] ? values[recordTitleField] : ""} failed to create.`,
|
|
4346
|
+
variant: "destructive",
|
|
4347
|
+
})
|
|
4348
|
+
}
|
|
4335
4349
|
}
|
|
4336
4350
|
})
|
|
4337
4351
|
.finally(() => {
|
|
@@ -4389,6 +4403,19 @@ function RecordForm({
|
|
|
4389
4403
|
})
|
|
4390
4404
|
}
|
|
4391
4405
|
await getOriginalRecord()
|
|
4406
|
+
setPrevState((prev) => {
|
|
4407
|
+
const newPrevState = { ...prev }
|
|
4408
|
+
for (const [key, value] of Object.entries(recordToSave)) {
|
|
4409
|
+
if (value instanceof FieldValue) {
|
|
4410
|
+
// eslint-disable-next-line security/detect-object-injection
|
|
4411
|
+
delete newPrevState[key]
|
|
4412
|
+
} else {
|
|
4413
|
+
// eslint-disable-next-line security/detect-object-injection
|
|
4414
|
+
newPrevState[key] = cloneDeep(value)
|
|
4415
|
+
}
|
|
4416
|
+
}
|
|
4417
|
+
return newPrevState
|
|
4418
|
+
})
|
|
4392
4419
|
setFormSavedKey((prev) => prev + 1)
|
|
4393
4420
|
setError(null)
|
|
4394
4421
|
if (userData) {
|
package/src/Login.tsx
CHANGED
|
@@ -267,7 +267,7 @@ export function Login() {
|
|
|
267
267
|
alt="Logo"
|
|
268
268
|
width="1920"
|
|
269
269
|
height="1080"
|
|
270
|
-
className="h-full w-full object-contain dark:brightness-[0.2] dark:grayscale"
|
|
270
|
+
className="h-full w-full p-6 object-contain dark:brightness-[0.2] dark:grayscale"
|
|
271
271
|
/>
|
|
272
272
|
)}
|
|
273
273
|
</div>
|