@stoker-platform/web-app 0.5.215 → 0.5.217
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 +12 -0
- package/package.json +1 -1
- package/src/Form.tsx +8 -2
- package/src/Images.tsx +1 -1
- package/src/utils/getFormattedFieldValue.tsx +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @stoker-platform/web-app
|
|
2
2
|
|
|
3
|
+
## 0.5.217
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix: fix image height and flicker issues
|
|
8
|
+
|
|
9
|
+
## 0.5.216
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- fix: prevent redirect to newly created records before server write completes
|
|
14
|
+
|
|
3
15
|
## 0.5.215
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/package.json
CHANGED
package/src/Form.tsx
CHANGED
|
@@ -4183,7 +4183,7 @@ function RecordForm({
|
|
|
4183
4183
|
}
|
|
4184
4184
|
|
|
4185
4185
|
const onValid = () => {
|
|
4186
|
-
if (!isServerReadOnly) {
|
|
4186
|
+
if (!(serverWrite || isServerReadOnly)) {
|
|
4187
4187
|
if (onSuccess) onSuccess({ ...recordToSave, id: docId, Collection_Path: path } as StokerRecord)
|
|
4188
4188
|
}
|
|
4189
4189
|
}
|
|
@@ -4211,6 +4211,8 @@ function RecordForm({
|
|
|
4211
4211
|
|
|
4212
4212
|
if (isServerReadOnly) {
|
|
4213
4213
|
setIsAddingServer(false)
|
|
4214
|
+
}
|
|
4215
|
+
if (serverWrite || isServerReadOnly) {
|
|
4214
4216
|
if (onSuccess)
|
|
4215
4217
|
onSuccess({ ...recordToSave, id: docId, Collection_Path: path } as StokerRecord)
|
|
4216
4218
|
}
|
|
@@ -4276,7 +4278,11 @@ function RecordForm({
|
|
|
4276
4278
|
return
|
|
4277
4279
|
}
|
|
4278
4280
|
const serverWrite = isServerUpdate(collection, { ...recordToSave, id }, userData)
|
|
4279
|
-
const optimisticUpdate = {
|
|
4281
|
+
const optimisticUpdate = {
|
|
4282
|
+
...(originalRecord ?? record),
|
|
4283
|
+
...cloneDeep(recordToSave),
|
|
4284
|
+
id,
|
|
4285
|
+
} as StokerRecord
|
|
4280
4286
|
setOptimisticUpdate(labels.collection, optimisticUpdate)
|
|
4281
4287
|
|
|
4282
4288
|
setGlobalLoading("+", id, serverWrite, !(serverWrite || isServerReadOnly))
|
package/src/Images.tsx
CHANGED
|
@@ -381,7 +381,7 @@ const Row = ({ index, style, data }: RowProps) => {
|
|
|
381
381
|
</div>
|
|
382
382
|
</div>
|
|
383
383
|
)}
|
|
384
|
-
<div className={cn("grid", "gap-4", size)}>
|
|
384
|
+
<div className={cn("grid", "gap-4", "auto-rows-fr", size)}>
|
|
385
385
|
{record[imagesConfig.imageField] ? (
|
|
386
386
|
<CopyImageOverlay src={record[imagesConfig.imageField]} className="w-full h-full">
|
|
387
387
|
<button
|
|
@@ -14,7 +14,7 @@ import { Check, X } from "lucide-react"
|
|
|
14
14
|
import { LoadingSpinner } from "@/components/ui/loading-spinner"
|
|
15
15
|
import { Button } from "@/components/ui/button"
|
|
16
16
|
import { preloadCacheEnabled } from "./preloadCacheEnabled"
|
|
17
|
-
import {
|
|
17
|
+
import { useLayoutEffect, useRef, useState } from "react"
|
|
18
18
|
import { cn } from "@/lib/utils"
|
|
19
19
|
import { getSafeUrl } from "./isSafeUrl"
|
|
20
20
|
|
|
@@ -23,7 +23,7 @@ const FormattedFieldImage = ({ src, alt, form }: { src: string; alt?: string; fo
|
|
|
23
23
|
const [loadedSrc, setLoadedSrc] = useState<string | null>(null)
|
|
24
24
|
const isLoaded = loadedSrc === src
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
useLayoutEffect(() => {
|
|
27
27
|
if (imgRef.current?.complete && imgRef.current.naturalWidth > 0) {
|
|
28
28
|
setLoadedSrc(src)
|
|
29
29
|
}
|