Skip to content

Commit d2b1195

Browse files
committed
docs(files): align stale dimension docs with the overwrite/self-heal behavior
Cleanup audit: the ImageDimensionsSource/reportImageDimensions interface docs and one route log string still said backfill-once/no-op; the mechanism overwrites on mismatch to self-correct. Wording only, no behavior change.
1 parent 4cabb83 commit d2b1195

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

apps/sim/app/api/workspaces/[id]/files/[fileId]/dimensions/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const PATCH = withRouteHandler(
4646
})
4747
return NextResponse.json({ success: written })
4848
} catch (error) {
49-
logger.error('Failed to backfill workspace file dimensions', {
49+
logger.error('Failed to store workspace file dimensions', {
5050
workspaceId,
5151
fileId,
5252
error: getErrorMessage(error),

apps/sim/hooks/use-file-content-source.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,17 @@ export interface ImageDimensions {
2828

2929
/**
3030
* Optional per-context capability: reserve layout space for an embedded image from its intrinsic size,
31-
* so it never reflows on load. The workspace source backs this with file-list metadata plus a lazy
32-
* backfill; public/embedded sources omit it and fall back to on-load measurement (one reflow, no persist).
31+
* so it never reflows on load. The workspace source backs this with file-list metadata plus a self-
32+
* correcting metadata write; public/embedded sources omit it and fall back to on-load measurement (one
33+
* reflow, no persist).
3334
*/
3435
export interface ImageDimensionsSource {
3536
/** Intrinsic dimensions for an embedded image `src` if already known — read synchronously at render. */
3637
getImageDimensions: (src: string | undefined) => ImageDimensions | null
37-
/** Persist an image's measured intrinsic dimensions (fire-and-forget; a no-op once already stored). */
38+
/**
39+
* Persist an image's measured intrinsic dimensions (fire-and-forget). Overwrites a stored value that
40+
* disagrees so a stale size self-corrects; a no-op only when the stored value already matches.
41+
*/
3842
reportImageDimensions: (src: string | undefined, dimensions: ImageDimensions) => void
3943
}
4044

0 commit comments

Comments
 (0)