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

Commit

Permalink
MOC-94 show demo after creation (#101)
Browse files Browse the repository at this point in the history
* show demo after creation

* formatting
  • Loading branch information
bkd705 authored Jul 22, 2024
1 parent 167399f commit c2de8e5
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 c2de8e5

Please sign in to comment.