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,
|
classroom,
|
||||||
selectedTabOption,
|
selectedTabOption,
|
||||||
onSelectTabOption,
|
onSelectTabOption,
|
||||||
|
isLoading,
|
||||||
}) {
|
}) {
|
||||||
const { title, paper, tabs, avatar, tooltip } = styles[layoutType];
|
const { title, paper, tabs, avatar, tooltip } = styles[layoutType];
|
||||||
return classroom === null ? (
|
return classroom === null ? (
|
||||||
|
@ -46,7 +47,11 @@ function Header({
|
||||||
sx={tabs}
|
sx={tabs}
|
||||||
>
|
>
|
||||||
{Object.values(TAB_OPTIONS).map(option => (
|
{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>
|
</Tabs>
|
||||||
</Paper>
|
</Paper>
|
||||||
|
|
|
@ -15,6 +15,7 @@ function View({
|
||||||
announcementsTabData,
|
announcementsTabData,
|
||||||
assignmentsTabData,
|
assignmentsTabData,
|
||||||
peopleTabData,
|
peopleTabData,
|
||||||
|
isLoading,
|
||||||
}) {
|
}) {
|
||||||
const { container } = styles[layoutType];
|
const { container } = styles[layoutType];
|
||||||
return (
|
return (
|
||||||
|
@ -24,6 +25,7 @@ function View({
|
||||||
classroom={classroom}
|
classroom={classroom}
|
||||||
selectedTabOption={selectedTabOption}
|
selectedTabOption={selectedTabOption}
|
||||||
onSelectTabOption={onSelectTabOption}
|
onSelectTabOption={onSelectTabOption}
|
||||||
|
isLoading={isLoading}
|
||||||
/>
|
/>
|
||||||
<AnnouncementsTab
|
<AnnouncementsTab
|
||||||
layoutType={layoutType}
|
layoutType={layoutType}
|
||||||
|
|
|
@ -119,6 +119,7 @@ function Classroom() {
|
||||||
peopleTabData={
|
peopleTabData={
|
||||||
tabData && tabData.tab === 'people' ? tabData : { state: 'gone' }
|
tabData && tabData.tab === 'people' ? tabData : { state: 'gone' }
|
||||||
}
|
}
|
||||||
|
isLoading={tabData && tabData.state === 'loading'}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue