From 570bf94aa66cb40f81889180c32e15fdda6a0659 Mon Sep 17 00:00:00 2001 From: Eric Pedley Date: Sun, 22 Oct 2023 22:09:52 -0700 Subject: [PATCH] Open error snackbar when we get an error during search (#749) --- .../src/components/RightPane/CoursePane/CourseRenderPane.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/antalmanac/src/components/RightPane/CoursePane/CourseRenderPane.tsx b/apps/antalmanac/src/components/RightPane/CoursePane/CourseRenderPane.tsx index c812b3d18..f2efc9c49 100644 --- a/apps/antalmanac/src/components/RightPane/CoursePane/CourseRenderPane.tsx +++ b/apps/antalmanac/src/components/RightPane/CoursePane/CourseRenderPane.tsx @@ -18,6 +18,7 @@ import AppStore from '$stores/AppStore'; import { isDarkMode, queryWebsoc, queryWebsocMultiple } from '$lib/helpers'; import Grades from '$lib/grades'; import analyticsEnum from '$lib/analytics'; +import { openSnackbar } from '$actions/AppStoreActions'; function flattenSOCObject(SOCObject: WebsocAPIResponse): (WebsocSchool | WebsocDepartment | AACourse)[] { const courseColors = AppStore.getAddedCourses().reduce((accumulator, { section }) => { @@ -40,7 +41,7 @@ function flattenSOCObject(SOCObject: WebsocAPIResponse): (WebsocSchool | WebsocD return accumulator; }, []); -}; +} const RecruitmentBanner = () => { const [bannerVisibility, setBannerVisibility] = React.useState(true); @@ -195,7 +196,9 @@ export function CourseRenderPane() { setError(false); setCourseData(flattenSOCObject(websocJsonResp)); } catch (error) { + console.error(error); setError(true); + openSnackbar('error', 'We ran into an error while looking up class info'); } finally { setLoading(false); }