Skip to content

Commit

Permalink
[frontend] wait for inject loading
Browse files Browse the repository at this point in the history
  • Loading branch information
isselparra committed Oct 15, 2024
1 parent 9dfb5ce commit bbacde4
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ const UpdateInject: React.FC<Props> = ({ open, handleClose, onUpdateInject, mass
const drawerRef = useRef(null);
const [availableTabs] = useState<string[]>(['Inject details', 'Logical chains']);
const [activeTab, setActiveTab] = useState<null | string>(availableTabs[0]);
const [isInjectLoading, setIsInjectLoading] = useState(true);
// Fetching data
const { inject } = useHelper((helper: InjectHelper) => ({
inject: helper.getInject(injectId),
}));

useDataLoader(() => {
dispatch(fetchInject(injectId));
setIsInjectLoading(true);
dispatch(fetchInject(injectId)).finally(() => setIsInjectLoading(false));
});

// Selection
Expand Down Expand Up @@ -70,7 +72,7 @@ const UpdateInject: React.FC<Props> = ({ open, handleClose, onUpdateInject, mass
})}
</Tabs>
)}
{(isAtomic || activeTab === 'Inject details') && (
{!isInjectLoading && (isAtomic || activeTab === 'Inject details') && (
<UpdateInjectDetails
drawerRef={drawerRef}
contractContent={injectorContract}
Expand All @@ -83,7 +85,7 @@ const UpdateInject: React.FC<Props> = ({ open, handleClose, onUpdateInject, mass
{...props}
/>
)}
{(!isAtomic && activeTab === 'Logical chains') && (
{(!isInjectLoading && !isAtomic && activeTab === 'Logical chains') && (
<UpdateInjectLogicalChains
inject={inject}
handleClose={handleClose}
Expand Down

0 comments on commit bbacde4

Please sign in to comment.