sidebar: do not invalidate for going to same file
Signed-off-by: Varun Patil <radialapps@gmail.com>pull/900/head
parent
af00252ed4
commit
f0c7cf7542
|
@ -385,7 +385,7 @@ export default defineComponent({
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
async update(photo: number | IPhoto): Promise<IImageInfo | null> {
|
async update(photo: number | IPhoto): Promise<IImageInfo | null> {
|
||||||
this.invalidate();
|
this.invalidateUnless(0);
|
||||||
|
|
||||||
// which clusters to get
|
// which clusters to get
|
||||||
const clusters = this.routeIsPublic
|
const clusters = this.routeIsPublic
|
||||||
|
@ -419,7 +419,12 @@ export default defineComponent({
|
||||||
if (this.fileid) await this.update(this.fileid);
|
if (this.fileid) await this.update(this.fileid);
|
||||||
},
|
},
|
||||||
|
|
||||||
invalidate() {
|
/**
|
||||||
|
* Invalidate metadata for a future change
|
||||||
|
* @param fileid Invalidate metadata unless this is the current fileid
|
||||||
|
*/
|
||||||
|
invalidateUnless(fileid: number) {
|
||||||
|
if (this.fileid === fileid) return;
|
||||||
this.state = Math.random();
|
this.state = Math.random();
|
||||||
this.loading = 0;
|
this.loading = 0;
|
||||||
this.error = false;
|
this.error = false;
|
||||||
|
|
|
@ -89,7 +89,7 @@ export default defineComponent({
|
||||||
open: this.open.bind(this),
|
open: this.open.bind(this),
|
||||||
close: this.close.bind(this),
|
close: this.close.bind(this),
|
||||||
setTab: this.setTab.bind(this),
|
setTab: this.setTab.bind(this),
|
||||||
invalidate: this.invalidate.bind(this),
|
invalidateUnless: this.invalidateUnless.bind(this),
|
||||||
getWidth: this.getWidth.bind(this),
|
getWidth: this.getWidth.bind(this),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -142,9 +142,9 @@ export default defineComponent({
|
||||||
this.native?.setActiveTab(tab);
|
this.native?.setActiveTab(tab);
|
||||||
},
|
},
|
||||||
|
|
||||||
invalidate() {
|
invalidateUnless(fileid: number) {
|
||||||
this.refs.metadata?.invalidate();
|
this.refs.metadata?.invalidateUnless(fileid);
|
||||||
this.nativeMetadata?.invalidate();
|
this.nativeMetadata?.invalidateUnless(fileid);
|
||||||
},
|
},
|
||||||
|
|
||||||
getWidth() {
|
getWidth() {
|
||||||
|
|
|
@ -1065,7 +1065,7 @@ export default defineComponent({
|
||||||
const abort = () => !this.isOpen || photo !== this.currentPhoto;
|
const abort = () => !this.isOpen || photo !== this.currentPhoto;
|
||||||
|
|
||||||
// Invalidate currently open metadata
|
// Invalidate currently open metadata
|
||||||
_m.sidebar.invalidate();
|
_m.sidebar.invalidateUnless(photo.fileid);
|
||||||
|
|
||||||
// Update the sidebar, first call immediate
|
// Update the sidebar, first call immediate
|
||||||
utils.setRenewingTimeout(
|
utils.setRenewingTimeout(
|
||||||
|
|
|
@ -48,7 +48,7 @@ declare global {
|
||||||
open: (photo: IPhoto | number, filename?: string, forceNative?: boolean) => void;
|
open: (photo: IPhoto | number, filename?: string, forceNative?: boolean) => void;
|
||||||
close: () => void;
|
close: () => void;
|
||||||
setTab: (tab: string) => void;
|
setTab: (tab: string) => void;
|
||||||
invalidate: () => void;
|
invalidateUnless: (fileid: number) => void;
|
||||||
getWidth: () => number;
|
getWidth: () => number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue