Skip to content

Commit

Permalink
Merge pull request #1174 from Vayras/ModalBug
Browse files Browse the repository at this point in the history
removed the small white module that appeared when clicking on bounty #1029
  • Loading branch information
elraphty authored Dec 26, 2023
2 parents 0379c11 + 25081aa commit 34601cf
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions frontend/app/src/people/main/bountyModal/BountyModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const BountyModal = ({ basePath, fromPage, bountyOwner }: BountyModalProp
const { person } = usePerson(ui.selectedPerson);
const [bounty, setBounty] = useState<PersonBounty[]>([]);
const [afterEdit, setAfterEdit] = useState(false);
const [loading, setLoading] = useState(true);

const personToDisplay = fromPage === 'usertickets' ? bountyOwner : person;

Expand All @@ -41,8 +42,14 @@ export const BountyModal = ({ basePath, fromPage, bountyOwner }: BountyModalProp
* infinite loop and crash the app
*/
if ((wantedId && !bounty.length) || afterEdit) {
const bounty = await main.getBountyById(Number(wantedId));
setBounty(bounty);
try {
const bountyData = await main.getBountyById(Number(wantedId));
setBounty(bountyData);
} catch (error) {
console.error('Error fetching bounty:', error);
} finally {
setLoading(false);
}
}
},
[bounty, main, wantedId]
Expand All @@ -61,6 +68,10 @@ export const BountyModal = ({ basePath, fromPage, bountyOwner }: BountyModalProp

const isMobile = useIsMobile();

if (loading) {
return null;
}

if (isMobile) {
return (
<Modal visible={true} fill={true}>
Expand Down

0 comments on commit 34601cf

Please sign in to comment.