Refresh on date change

pull/62/head
Varun Patil 2022-09-25 07:53:14 -07:00
parent c7a60473a4
commit 97496ce7ab
2 changed files with 19 additions and 3 deletions

View File

@ -237,6 +237,7 @@ export default class EditDate extends Mixins(GlobalMixin) {
const res = await axios.patch<any>(generateUrl(EDIT_API_URL, { id: this.photos[0].fileid }), {
date: this.getExifFormat(this.getDate()),
});
this.$emit('refresh', true);
this.close();
} catch (e) {
if (e.response?.data?.message) {
@ -294,6 +295,7 @@ export default class EditDate extends Mixins(GlobalMixin) {
// nothing to do
}
this.processing = false;
this.$emit('refresh', true);
this.close();
}

View File

@ -120,7 +120,7 @@
</NcActions>
</div>
<EditDate ref="editDate" />
<EditDate ref="editDate" @refresh="refresh" />
</div>
</template>
@ -240,8 +240,7 @@ export default class Timeline extends Mixins(GlobalMixin, UserConfig) {
@Watch('$route')
async routeChange(from: any, to: any) {
await this.resetState();
await this.createState();
await this.refresh();
}
beforeDestroy() {
@ -302,6 +301,21 @@ export default class Timeline extends Mixins(GlobalMixin, UserConfig) {
}
}
/** Recreate everything */
async refresh(preservePosition = false) {
// Get current scroll position
const origScroll = (<any>this.$refs.recycler).$el.scrollTop;
// Reset state
await this.resetState();
await this.createState();
// Restore scroll position
if (preservePosition) {
(<any>this.$refs.recycler).scrollToPosition(origScroll);
}
}
/** Do resize after some time */
handleResizeWithDelay() {
if (this.resizeTimer) {