feat(editor): Update to personalization survey v4 (#5474)

* feat(editor): update to personalization survey v4

* refactor: rename role other key for consistency

* feat: add reported source to survey

* test: add unit tests for personalization modal
This commit is contained in:
Alex Grozav
2023-02-15 15:05:55 +02:00
committed by GitHub
parent a3d8fac73a
commit 6265f3a27a
9 changed files with 667 additions and 76 deletions

View File

@@ -0,0 +1,17 @@
export const retry = (assertion: () => any, { interval = 20, timeout = 200 } = {}) => {
return new Promise((resolve, reject) => {
const startTime = Date.now();
const tryAgain = () => {
setTimeout(() => {
try {
resolve(assertion());
} catch (err) {
Date.now() - startTime > timeout ? reject(err) : tryAgain();
}
}, interval);
};
tryAgain();
});
};