From 4a838bc30207c5191b96009ca45a9628f103d7ba Mon Sep 17 00:00:00 2001 From: Oscar Eriksson Date: Fri, 27 Sep 2024 21:29:50 +0200 Subject: [PATCH] Make suggestions show up --- frontend/src/components/Suggestions.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/Suggestions.tsx b/frontend/src/components/Suggestions.tsx index 420b2c8..e4f3486 100644 --- a/frontend/src/components/Suggestions.tsx +++ b/frontend/src/components/Suggestions.tsx @@ -1,6 +1,6 @@ "use client"; -import { useState } from "react"; +import {useEffect, useState} from "react"; import { Suggestion, SuggestionWithState } from "../lib/goldapps/types"; import { commitSuggestions } from "../lib/goldapps/commit-suggestions"; import { SuggestionsTable } from "./SuggestionsTable"; @@ -18,6 +18,12 @@ export const Suggestions = ({ suggestions: serverSuggestions }: Props) => { })), ); + useEffect(() => { setSuggestions( serverSuggestions.map(suggestion => ({ + ...suggestion, + selected: false, + error: null, + }))) }, [serverSuggestions]); + const onCommit = async () => { // Sending each change as a separate request allows us to show on which ones // the errors occur