Fix video modal rehydration after back navigation

This commit is contained in:
thePR0M3TH3AN committed 2025-10-09 19:59:00 -04:00
1 parent ca959cb33e
commit 5463677237
1 file changed
+18 -2
+18 -2
View File
@@ -1313,9 +1313,25 @@ class Application {
const existingVideoElement = getVideoElement();
if (existingRoot && existingRoot.isConnected) {
if (ensureVideoElement && !existingVideoElement) {
throw new Error("Video modal video element is not ready.");
if (!existingVideoElement && ensureVideoElement) {
if (typeof this.videoModal.load === "function") {
await this.videoModal.load();
}
const rehydratedRoot = getRoot();
const rehydratedVideoElement = getVideoElement();
if (!rehydratedVideoElement) {
throw new Error("Video modal video element is not ready.");
}
this.modalVideo = rehydratedVideoElement;
return {
root: rehydratedRoot || existingRoot,
videoElement: rehydratedVideoElement,
};
}
if (existingVideoElement) {
this.modalVideo = existingVideoElement;
}