Skip to content

Commit

Permalink
Make sure courses are updated after switching
Browse files Browse the repository at this point in the history
  • Loading branch information
robertying committed May 24, 2019
1 parent a9ef55b commit d7a2efd
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
4 changes: 1 addition & 3 deletions src/screens/AssignmentsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,7 @@ const AssignmentsScreen: INavigationScreen<IAssignmentsScreenProps> = props => {
const [searchResult, setSearchResult] = useState(assignments);

useEffect(() => {
if (assignments.length) {
setSearchResult(assignments);
}
setSearchResult(assignments);
}, [assignments.length]);

useEffect(() => {
Expand Down
4 changes: 1 addition & 3 deletions src/screens/FilesScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,7 @@ const FilesScreen: INavigationScreen<IFilesScreenProps> = props => {
const [searchResult, setSearchResult] = useState(files);

useEffect(() => {
if (files.length) {
setSearchResult(files);
}
setSearchResult(files);
}, [files.length]);

useEffect(() => {
Expand Down
4 changes: 1 addition & 3 deletions src/screens/NoticesScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,7 @@ const NoticesScreen: INavigationScreen<INoticesScreenProps> = props => {
const [searchResult, setSearchResult] = useState(notices);

useEffect(() => {
if (notices.length) {
setSearchResult(notices);
}
setSearchResult(notices);
}, [notices.length]);

useEffect(() => {
Expand Down
6 changes: 4 additions & 2 deletions src/screens/SemestersSettingsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const SemestersSettingsScreen: INavigationScreen<
return () => {
store.dispatch(getCoursesForSemester(currentSemester as string));
};
}, []);
}, [currentSemester]);

const renderListItem: ListRenderItem<ISemester> = ({ item }) => {
return (
Expand All @@ -41,7 +41,9 @@ const SemestersSettingsScreen: INavigationScreen<
text={item as string}
icon={currentSemester === item ? <Icon name="check" size={20} /> : null}
// tslint:disable-next-line: jsx-no-lambda
onPress={() => setCurrentSemester(item)}
onPress={() => {
setCurrentSemester(item);
}}
/>
);
};
Expand Down

0 comments on commit d7a2efd

Please sign in to comment.