Skip to content

Commit

Permalink
Adjust private label logic
Browse files Browse the repository at this point in the history
Signed-off-by: Gabriel Indik <[email protected]>
  • Loading branch information
gabriel-indik committed Nov 15, 2024
1 parent 80ea5db commit 56290c0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ui/client/src/components/Transaction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const Transaction: React.FC<Props> = ({

const [viewDetailsDialogOpen, setViewDetailsDialogOpen] = useState(false);
const receiptCount = (transactionReceipts && transactionReceipts.length) ? transactionReceipts.length : 0;
const receiptIsPrivate = (transactionReceipts && transactionReceipts.length && transactionReceipts[0].domain !== '');
const receiptIsPrivate = (transactionReceipts && transactionReceipts.length && transactionReceipts[0].domain !== undefined);
const typeKey =
receiptCount > 1 ? 'atomicNumber' :
receiptIsPrivate ? 'private' :
Expand Down
11 changes: 7 additions & 4 deletions ui/client/src/contexts/ApplicationContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ interface Props {

export const ApplicationContextProvider = ({ children, colorMode }: Props) => {

const [autoRefreshEnabled, setAutoRefreshEnabled] = useState(true);
const [lastBlockWithTransactions, setLastBlockWithTransactions] = useState(0);
const [autoRefreshEnabled, setAutoRefreshEnabled] = useState(false);
const [lastBlockWithTransactions, setLastBlockWithTransactions] = useState(-1);
const [refreshRequired, setRefreshRequired] = useState(false);

const { data: actualLastBlockWithTransactions, error } = useQuery({
Expand All @@ -43,15 +43,18 @@ export const ApplicationContextProvider = ({ children, colorMode }: Props) => {
retry: false
});


useEffect(() => {


if(actualLastBlockWithTransactions !== undefined
&& actualLastBlockWithTransactions > lastBlockWithTransactions) {
if(autoRefreshEnabled) {

if(autoRefreshEnabled || lastBlockWithTransactions === -1) {
setLastBlockWithTransactions(actualLastBlockWithTransactions);
} else {
setRefreshRequired(true);
}

}
}, [actualLastBlockWithTransactions, lastBlockWithTransactions, setLastBlockWithTransactions]);

Expand Down

0 comments on commit 56290c0

Please sign in to comment.