Fixed empty state flashing issue on offers list (#19863)

ref DES-101, DES-105
This commit is contained in:
Sodbileg Gansukh 2024-03-14 17:25:48 +08:00 committed by GitHub
parent 2029a5846a
commit 04c9bf0197
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -93,7 +93,7 @@ export const CopyLinkButton: React.FC<{offerCode: string}> = ({offerCode}) => {
export const OffersIndexModal = () => {
const modal = useModal();
const {updateRoute} = useRouting();
const {data: {offers: allOffers = []} = {}} = useBrowseOffers({
const {data: {offers: allOffers = []} = {}, isFetching: isFetchingOffers} = useBrowseOffers({
searchParams: {
limit: 'all'
}
@ -260,13 +260,13 @@ export const OffersIndexModal = () => {
</div>
</div>
</header>
{selectedTab === 'active' && activeOffers.length === 0 ?
{selectedTab === 'active' && activeOffers.length === 0 && !isFetchingOffers ?
<NoValueLabel icon='tags-block'>
No offers found.
</NoValueLabel> :
null
}
{selectedTab === 'archived' && archivedOffers.length === 0 ?
{selectedTab === 'archived' && archivedOffers.length === 0 && !isFetchingOffers ?
<NoValueLabel icon='tags-block'>
No offers found.
</NoValueLabel> :