mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-09 19:40:19 +00:00
Fix recursive link history updates for picture viewer
This commit is contained in:
@ -137,7 +137,12 @@ document.addEventListener("alpine:init", () => {
|
||||
this.current_picture = this.pictures.find(
|
||||
(i) => i.id === first_picture_id,
|
||||
);
|
||||
this.$watch("current_picture", () => this.update_picture());
|
||||
this.$watch("current_picture", (current, previous) => {
|
||||
if (current === previous){ /* Avoid recursive updates */
|
||||
return;
|
||||
}
|
||||
this.update_picture();
|
||||
});
|
||||
window.addEventListener("popstate", async (event) => {
|
||||
if (!event.state || event.state.sas_picture_id === undefined) {
|
||||
return;
|
||||
|
Reference in New Issue
Block a user