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

Commit

Permalink
show demo after creation
Browse files Browse the repository at this point in the history
  • Loading branch information
bkd705 committed Jul 19, 2024
1 parent 167399f commit 5513c9e
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions apps/mocksi-lite/content/ListPopup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { Recording } from "../../background";
import Button from "../../common/Button";
import Divider from "../../common/Divider";
import Popup from "../../common/Popup";
import { getRecordingsStorage } from "../../utils";
import { getRecordingsStorage, sendMessage } from "../../utils";
import { AppEvent, AppStateContext } from "../AppStateContext";
import DemoItem from "./DemoItem";

Expand All @@ -19,18 +19,12 @@ const ListPopup = ({ email, onChat, onClose, onLogout }: ListPopupProps) => {
const [recordings, setRecordings] = useState<Recording[]>([]);

const getRecordings = async () => {
let continueFetching = true;
while (continueFetching) {
try {
const newRecordings = await getRecordingsStorage();
if (newRecordings.length !== recordings.length) {
setRecordings(newRecordings);
continueFetching = false; // Stop the loop if recordings have been updated
}
} catch (error) {
continueFetching = false; // Stop the loop in case of an error
}
}
sendMessage("getRecordings", {}, (response) => {
const { body } = response;
const { recordings } = body as { recordings: Recording[] };

setRecordings(recordings);
})
};

// biome-ignore lint/correctness/useExhaustiveDependencies:
Expand Down

0 comments on commit 5513c9e

Please sign in to comment.