mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
Ensure video modal rehydrates when video element is missing
This commit is contained in:
1 parent
5463677237
commit
d58d411180
1 file changed
+22
-2
@@ -127,8 +127,28 @@ export class VideoModal {
|
||||
}
|
||||
|
||||
async load() {
|
||||
if (this.loaded && this.playerModal && this.playerModal.isConnected) {
|
||||
return this.playerModal;
|
||||
if (this.loaded) {
|
||||
const root = this.playerModal;
|
||||
const rootConnected = root && root.isConnected;
|
||||
if (rootConnected) {
|
||||
const video = this.modalVideo;
|
||||
const videoConnected = video && video.isConnected;
|
||||
if (!videoConnected) {
|
||||
const existingVideo = root.querySelector("#modalVideo");
|
||||
if (existingVideo) {
|
||||
this.hydrate(root);
|
||||
if (this.modalVideo && this.modalVideo.isConnected) {
|
||||
return this.playerModal;
|
||||
}
|
||||
}
|
||||
this.loaded = false;
|
||||
} else {
|
||||
return this.playerModal;
|
||||
}
|
||||
} else {
|
||||
this.loaded = false;
|
||||
this.playerModal = null;
|
||||
}
|
||||
}
|
||||
|
||||
const existing = this.document.getElementById("playerModal");
|
||||
|
||||
Reference in new issue
Block a user