refactor(StorePage/index.tsx): rename variable 'result' to 'data' for clarity and consistency

refactor(StorePage/index.tsx): handle null or undefined value for 'data.results' by assigning an empty array to 'results' variable
This commit is contained in:
anovazzi1 2023-11-07 11:34:09 -03:00
commit 5a5b95afa5

View file

@ -70,9 +70,10 @@ export default function StorePage(): JSX.Element {
async function getSavedComponents() { async function getSavedComponents() {
setLoading(true); setLoading(true);
const result = await getStoreSavedComponents(); const data = await getStoreSavedComponents();
let savedIds = new Set<string>(); let savedIds = new Set<string>();
result.forEach((flow) => { let results = data?.results ?? [];
results.forEach((flow) => {
savedIds.add(flow.id); savedIds.add(flow.id);
}); });
setSavedFlows(savedIds); setSavedFlows(savedIds);