Skip to content

Commit

Permalink
Merge pull request #115 from fc5y/huynhnhan.ngo/remove-skeleton-addin…
Browse files Browse the repository at this point in the history
…g-new-rows-in-table

Remove skeleton adding new rows in table
  • Loading branch information
hnngo authored Jan 2, 2021
2 parents 66a68c0 + 9608138 commit 8a4663c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 15 deletions.
5 changes: 0 additions & 5 deletions src/app/containers/Contests/ContestsHome/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const Container = styled.div`
function Contests() {
const [currentLimit, setCurrentLimit] = React.useState(10);
const [currentOffset, setCurrentOffset] = React.useState(0);
const [isAddingNewRows, setIsAddingNewRows] = React.useState(false);
const {
apiState,
todayContests,
Expand All @@ -36,8 +35,6 @@ function Contests() {
} = useFetchContestInfo({
limit: currentLimit,
offset: currentOffset,
forceFetch: isAddingNewRows,
onFetchCompleted: () => setIsAddingNewRows(false),
});

return (
Expand All @@ -55,12 +52,10 @@ function Contests() {
/>
<EndedContests
isLoading={apiState.progress === API_PROGRESS.REQ && endedContests.length === 0}
isAddingNewRows={isAddingNewRows}
contests={endedContests}
totalContests={totalContests}
onClickPageSize={(newSize) => {
setCurrentLimit(newSize);
setIsAddingNewRows(() => currentLimit < newSize);
}}
onClickPageNumber={(num) => setCurrentOffset((num - 1) * currentLimit)}
/>
Expand Down
9 changes: 1 addition & 8 deletions src/app/containers/HomePage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,9 @@ const BannerImageWrapper = styled.div`

function HomePage() {
const { userInfo } = React.useContext(UserInfoContext);
const [isAddingNewRows, setIsAddingNewRows] = React.useState(false);
const { apiState, onGoingContests, endedContests } = useFetchContestInfo({
limit: 10,
offset: 0,
forceFetch: isAddingNewRows,
onFetchCompleted: () => setIsAddingNewRows(false),
});

return (
Expand All @@ -81,11 +78,7 @@ function HomePage() {
Chú ý: Trang web freecontest.net đang trong giai đoạn thử nghiệm. Mọi dữ liệu sẽ bị
xóa vào ngày 25/01/2021. Kể từ ngày 01/02/2021, các thí sinh có thể đăng nhập bằng
username và password của tài khoản cũ (tài khoản trên trang freecontest.xyz). Xem
chi tiết tại{' '}
<Link target="_blank" to={ROUTE_MIGRATION_PLAN}>
đây
</Link>
.
chi tiết tại <Link to={ROUTE_MIGRATION_PLAN}>đây</Link>.
</AlertContent>
}
/>
Expand Down
4 changes: 2 additions & 2 deletions src/shared/hook/useFetchContestsInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ function useFetchContestInfo({ limit, offset, forceFetch, onFetchCompleted }) {
} else {
setOnGoingContests([]);
setEndedContests([]);
fetchContestsInfo();
}
}, [contests, limit, offset]);
fetchContestsInfo();
}, [limit, offset]);

return {
apiState,
Expand Down

0 comments on commit 8a4663c

Please sign in to comment.