Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

fix: LEAP-740: Don't use destroy = null #1706

Merged
merged 5 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion e2e/tests/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,16 @@ const createAddEventListenerScript = (eventName, callback) => {
* Wait for the main Image object to be loaded
*/
const waitForImage = () => {
return new Promise((resolve) => {
return new Promise((resolve, reject) => {
const img = document.querySelector('[alt=LS]');

if (!img || img.complete) return resolve();
// this should be rewritten to isReady when it is ready
img.onload = () => {
setTimeout(resolve, 100);
};
// if image is not loaded in 10 seconds, reject
setTimeout(reject, 10000);
});
};

Expand Down
2 changes: 1 addition & 1 deletion src/LabelStudio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class LabelStudio {
root: Element | string;
store: any;

destroy: (() => void) | null = null;
destroy: (() => void) | null = () => {};
events = new EventInvoker();

getRootElement(root: Element | string) {
Expand Down
Loading