Skip to content

Commit 0f1c872

Browse files
authored
Merge pull request #18 from Q42/feature/can-force-data-refresh
added Settings.forceDataRefresh
2 parents a5592aa + ab15654 commit 0f1c872

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

src/ts/globals.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ export const ATTRIBUTE_OPTIONS: {
155155
'data-is360': {r:true},
156156
'data-no-externals': {f:'noExternals'},
157157
'data-skipmeta': {f:'skipMeta'},
158+
'data-force-data-refresh': {f:'forceDataRefresh'},
158159
'data-keeprendering': {f:'keepRendering'},
159160
'data-coverlimit': {f:'limitToCoverScale'},
160161
'data-events': {f:'hookEvents'},

src/ts/image.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ export class MicrioImage {
457457
const skipMeta = this.$settings?.skipMeta || this.__info.settings?.skipMeta;
458458
if(this._loadedData || skipMeta) return Promise.resolve();
459459
this._loadedData = true;
460-
const data = this.preset?.[2] ?? (this.isV5 && await fetchJson<Models.ImageData.ImageData>(this.dataPath+this.id+'/data/pub.json').catch(() => {}));
460+
const data = this.preset?.[2] ?? (this.isV5 && await fetchJson<Models.ImageData.ImageData>(this.dataPath+this.id+'/data/pub.json'+(this.__info.settings?.forceDataRefresh?'?'+Math.random():'')).catch(() => {}));
461461
if(data) this.enrichData(data).then(d => this.data.set(d));
462462
}
463463

src/types/models.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ import type { IconDefinition } from '@fortawesome/free-solid-svg-icons';
209209

210210
/** Use a custom uri for the info json file */
211211
infoUrl?: string;
212+
/** Force refresh for published data JSON file */
213+
forceDataRefresh?: boolean;
212214
/** Render this image as a static image */
213215
static?: boolean;
214216
/** Use a custom thumbnail image uri */

0 commit comments

Comments
 (0)