Refresh on date change
parent
c7a60473a4
commit
97496ce7ab
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue