Automatically refresh app iframe

This commit is contained in:
Will Chen
2025-04-18 14:21:38 -07:00
parent 86b9720179
commit 59de308e82
4 changed files with 18 additions and 3 deletions

View File

@@ -50,6 +50,8 @@ export function ChatInput({ chatId }: { chatId?: number }) {
const [messages, setMessages] = useAtom<Message[]>(chatMessagesAtom);
const setIsPreviewOpen = useSetAtom(isPreviewOpenAtom);
const { refreshAppIframe } = useRunApp();
// Use the hook to fetch the proposal
const {
proposalResult,
@@ -140,6 +142,9 @@ export function ChatInput({ chatId }: { chatId?: number }) {
} finally {
setIsApproving(false);
setIsPreviewOpen(true);
refreshAppIframe();
// Keep same as handleReject
refreshProposal();
fetchChatMessages();
}
@@ -169,6 +174,8 @@ export function ChatInput({ chatId }: { chatId?: number }) {
setError((err as Error)?.message || "An error occurred while rejecting");
} finally {
setIsRejecting(false);
// Keep same as handleApprove
refreshProposal();
fetchChatMessages();
}

View File

@@ -55,8 +55,8 @@ const ErrorBanner = ({ error, onDismiss, onAIFix }: ErrorBannerProps) => {
<Lightbulb size={16} className=" text-red-800 dark:text-red-300" />
</div>
<span className="text-sm text-red-700 dark:text-red-200">
<span className="font-medium">Tip: </span>Check if refreshing the
page or restarting the app fixes the error.
<span className="font-medium">Tip: </span>Check if restarting the
app fixes the error.
</span>
</div>
</div>