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: {
|
||||
async update(photo: number | IPhoto): Promise<IImageInfo | null> {
|
||||
this.invalidate();
|
||||
this.invalidateUnless(0);
|
||||
|
||||
// which clusters to get
|
||||
const clusters = this.routeIsPublic
|
||||
|
@ -419,7 +419,12 @@ export default defineComponent({
|
|||
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.loading = 0;
|
||||
this.error = false;
|
||||
|
|
|
@ -89,7 +89,7 @@ export default defineComponent({
|
|||
open: this.open.bind(this),
|
||||
close: this.close.bind(this),
|
||||
setTab: this.setTab.bind(this),
|
||||
invalidate: this.invalidate.bind(this),
|
||||
invalidateUnless: this.invalidateUnless.bind(this),
|
||||
getWidth: this.getWidth.bind(this),
|
||||
};
|
||||
|
||||
|
@ -142,9 +142,9 @@ export default defineComponent({
|
|||
this.native?.setActiveTab(tab);
|
||||
},
|
||||
|
||||
invalidate() {
|
||||
this.refs.metadata?.invalidate();
|
||||
this.nativeMetadata?.invalidate();
|
||||
invalidateUnless(fileid: number) {
|
||||
this.refs.metadata?.invalidateUnless(fileid);
|
||||
this.nativeMetadata?.invalidateUnless(fileid);
|
||||
},
|
||||
|
||||
getWidth() {
|
||||
|
|
|
@ -1065,7 +1065,7 @@ export default defineComponent({
|
|||
const abort = () => !this.isOpen || photo !== this.currentPhoto;
|
||||
|
||||
// Invalidate currently open metadata
|
||||
_m.sidebar.invalidate();
|
||||
_m.sidebar.invalidateUnless(photo.fileid);
|
||||
|
||||
// Update the sidebar, first call immediate
|
||||
utils.setRenewingTimeout(
|
||||
|
|
|
@ -48,7 +48,7 @@ declare global {
|
|||
open: (photo: IPhoto | number, filename?: string, forceNative?: boolean) => void;
|
||||
close: () => void;
|
||||
setTab: (tab: string) => void;
|
||||
invalidate: () => void;
|
||||
invalidateUnless: (fileid: number) => void;
|
||||
getWidth: () => number;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue