viewer: reduce round trip for sidebar load
Signed-off-by: Varun Patil <radialapps@gmail.com>pull/803/head
parent
ff481dffbb
commit
224bd3c2c9
|
@ -90,8 +90,8 @@ export default defineComponent({
|
|||
},
|
||||
|
||||
methods: {
|
||||
async open(photo: IPhoto | number, filename?: string, forceNative = false) {
|
||||
if (!this.reducedOpen && this.native && (!photo || forceNative)) {
|
||||
async open(photo: IPhoto | number, filename?: string, useNative = false) {
|
||||
if (!this.reducedOpen && this.native && (!photo || useNative)) {
|
||||
// Open native sidebar
|
||||
this.native?.setFullScreenMode?.(true);
|
||||
this.native?.open(filename);
|
||||
|
|
|
@ -1046,11 +1046,22 @@ export default defineComponent({
|
|||
if (this.routeIsPublic || this.isLocal) {
|
||||
globalThis.mSidebar.open(photo);
|
||||
} else {
|
||||
// check if file path is already loaded with image info
|
||||
let filename = photo.imageInfo?.filename;
|
||||
let useNative = !!filename;
|
||||
|
||||
// get filename from DAV if not already loaded
|
||||
if (!filename) {
|
||||
const fileInfo = (await dav.getFiles([photo]))[0];
|
||||
if (abort()) return;
|
||||
|
||||
const forceNative = fileInfo?.originalFilename?.startsWith('/files/');
|
||||
globalThis.mSidebar.open(photo, fileInfo?.filename, forceNative);
|
||||
// get filename
|
||||
filename = fileInfo?.filename;
|
||||
useNative = fileInfo?.originalFilename?.startsWith('/files/');
|
||||
}
|
||||
|
||||
// open sidebar
|
||||
globalThis.mSidebar.open(photo, filename, useNative);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue