mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-06 04:42:57 +00:00
Fix video modal rehydration after back navigation
This commit is contained in:
1 parent
ca959cb33e
commit
5463677237
1 file changed
+18
-2
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user