Skip to content

Commit edc12fe

Browse files
committed
fix(player): Resolve race condition on initialization
The previous implementation of the `InteractiveVideo` component was susceptible to a race condition where the `IVLabsPlayer` could be initialized before the container element was available in the DOM. This would cause the player to fail to load. This commit resolves the issue by wrapping the player initialization in a `setTimeout` with a delay of 0. This ensures that the player is only initialized after the current event loop has completed and the container element is available. Additionally, this commit: - Adds the `@vitejs/plugin-react` dependency to support React in Vite. - Updates the Vitest configuration to include the React plugin. - Refactors the event listener registration to be more robust.
1 parent 4e51a03 commit edc12fe

File tree

5 files changed

+370
-17
lines changed

5 files changed

+370
-17
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"react-dom": ">=17.0.0 || >=18.0.0"
5353
},
5454
"dependencies": {
55+
"@vitejs/plugin-react": "^4.7.0",
5556
"jsdom": "^26.1.0",
5657
"tsup": "^8.5.0",
5758
"typescript": "^5.8.3",

0 commit comments

Comments
 (0)