I don't know why, but it seems useSonarEntity intentionally treats 404 as no-error, which a little bit confusing, especially, there is no any notes in documentation about that edge case.
const refetch = useCallback2(async () => {
if (!walletAddress || !fullyConnected) {
return;
}
setState((s) => ({ ...s, loading: true }));
try {
const resp = await client.readEntity({
saleUUID,
walletAddress
});
setState({
loading: false,
entity: resp.Entity,
walletAddress,
error: void 0,
hasFetched: true
});
} catch (err) {
if (err instanceof APIError && err.status === 404) {
setState({
loading: false,
entity: void 0,
walletAddress: void 0,
error: void 0,
hasFetched: true
});
return;
}
const error = err instanceof Error ? err : new Error(String(err));
setState({ loading: false, entity: void 0, walletAddress: void 0, error, hasFetched: true });
}
}, [client, saleUUID, walletAddress, fullyConnected]);
I don't know why, but it seems
useSonarEntityintentionally treats 404 as no-error, which a little bit confusing, especially, there is no any notes in documentation about that edge case.