@@ -15,6 +15,8 @@ interface PublicFileViewProps {
1515 name : string
1616 type : string
1717 size : number
18+ /** Content version (the file's `updatedAt`, epoch ms) — busts the viewer's caches when the file changes. */
19+ version : number
1820 workspaceName : string | null
1921 ownerName : string | null
2022}
@@ -24,6 +26,7 @@ export function PublicFileView({
2426 name,
2527 type,
2628 size,
29+ version,
2730 workspaceName,
2831 ownerName,
2932} : PublicFileViewProps ) {
@@ -35,23 +38,26 @@ export function PublicFileView({
3538
3639 // The public viewer reuses the in-app FileViewer; the content source seam swaps
3740 // the auth-gated workspace serve URL for the token-scoped public endpoint, and a
38- // synthetic record carries the metadata the renderers/query keys need.
41+ // synthetic record carries the metadata the renderers/query keys need. `key` and
42+ // `updatedAt` fold in the content version so the React Query caches (keyed on the
43+ // storage key + `updatedAt`) refetch when the shared file changes — even when its
44+ // size is unchanged.
3945 const source = useMemo < FileContentSource > ( ( ) => ( { buildUrl : ( ) => contentUrl } ) , [ contentUrl ] )
4046 const file = useMemo < WorkspaceFileRecord > (
4147 ( ) => ( {
4248 id : token ,
4349 workspaceId : token ,
4450 name,
45- key : token ,
51+ key : ` ${ token } @ ${ version } ` ,
4652 path : contentUrl ,
4753 size,
4854 type,
4955 uploadedBy : '' ,
5056 folderId : null ,
51- uploadedAt : new Date ( 0 ) ,
52- updatedAt : new Date ( 0 ) ,
57+ uploadedAt : new Date ( version ) ,
58+ updatedAt : new Date ( version ) ,
5359 } ) ,
54- [ token , name , type , size , contentUrl ]
60+ [ token , name , type , size , version , contentUrl ]
5561 )
5662
5763 return (
0 commit comments