Fix race condition when fetch tab data
This commit is contained in:
parent
6fb5af6ea5
commit
5d400bfadd
3 changed files with 9 additions and 1 deletions
|
@ -18,6 +18,7 @@ function Header({
|
|||
classroom,
|
||||
selectedTabOption,
|
||||
onSelectTabOption,
|
||||
isLoading,
|
||||
}) {
|
||||
const { title, paper, tabs, avatar, tooltip } = styles[layoutType];
|
||||
return classroom === null ? (
|
||||
|
@ -46,7 +47,11 @@ function Header({
|
|||
sx={tabs}
|
||||
>
|
||||
{Object.values(TAB_OPTIONS).map(option => (
|
||||
<Tab key={option.value} label={option.lable} />
|
||||
<Tab
|
||||
key={option.value}
|
||||
label={option.lable}
|
||||
disabled={isLoading && option.value !== selectedTabOption}
|
||||
/>
|
||||
))}
|
||||
</Tabs>
|
||||
</Paper>
|
||||
|
|
|
@ -15,6 +15,7 @@ function View({
|
|||
announcementsTabData,
|
||||
assignmentsTabData,
|
||||
peopleTabData,
|
||||
isLoading,
|
||||
}) {
|
||||
const { container } = styles[layoutType];
|
||||
return (
|
||||
|
@ -24,6 +25,7 @@ function View({
|
|||
classroom={classroom}
|
||||
selectedTabOption={selectedTabOption}
|
||||
onSelectTabOption={onSelectTabOption}
|
||||
isLoading={isLoading}
|
||||
/>
|
||||
<AnnouncementsTab
|
||||
layoutType={layoutType}
|
||||
|
|
|
@ -119,6 +119,7 @@ function Classroom() {
|
|||
peopleTabData={
|
||||
tabData && tabData.tab === 'people' ? tabData : { state: 'gone' }
|
||||
}
|
||||
isLoading={tabData && tabData.state === 'loading'}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue