(qol): formatted
This commit is contained in:
parent
c7ea9495bd
commit
1bc77fc146
2 changed files with 7 additions and 5 deletions
|
|
@ -92,9 +92,7 @@ export default function InputComponent({
|
||||||
ref={inputBoxRef}
|
ref={inputBoxRef}
|
||||||
className={cn(
|
className={cn(
|
||||||
"rounded-none border-b-0 pt-0 pb-[env(safe-area-inset-bottom)] mx-2",
|
"rounded-none border-b-0 pt-0 pb-[env(safe-area-inset-bottom)] mx-2",
|
||||||
isMobile
|
isMobile ? "border-0 border-t w-full mx-0 px-2" : "rounded-t-xl",
|
||||||
? "border-0 border-t w-full mx-0 px-2"
|
|
||||||
: "rounded-t-xl",
|
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<CardHeader className="relative p-0 flex flex-col">
|
<CardHeader className="relative p-0 flex flex-col">
|
||||||
|
|
|
||||||
|
|
@ -186,6 +186,7 @@ export function Provider(props: {
|
||||||
typeof createTransportClient<Schemas>
|
typeof createTransportClient<Schemas>
|
||||||
> | null>(null);
|
> | null>(null);
|
||||||
const identificationStartedRef = useRef(false);
|
const identificationStartedRef = useRef(false);
|
||||||
|
const reconnectExhaustedRef = useRef(false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends typed protocol messages through the active transport client.
|
* Sends typed protocol messages through the active transport client.
|
||||||
|
|
@ -315,12 +316,14 @@ export function Provider(props: {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attempts >= RECONNECT_TRIES) {
|
if (reconnectExhaustedRef.current || attempts >= RECONNECT_TRIES) {
|
||||||
|
reconnectExhaustedRef.current = true;
|
||||||
setError("Connection Failed");
|
setError("Connection Failed");
|
||||||
setErrorDescription(
|
setErrorDescription(
|
||||||
"Unable to connect to the server after multiple attempts. Please check your internet connection or try again later.",
|
"Unable to connect to the server after multiple attempts. Please check your internet connection or try again later.",
|
||||||
);
|
);
|
||||||
log(0, "ttp", "red", "Reconnection attempts exhausted", reason);
|
log(0, "ttp", "red", "Reconnection attempts exhausted", reason);
|
||||||
|
void transportClient?.close("reconnect-exhausted");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -342,6 +345,7 @@ export function Provider(props: {
|
||||||
if (state === READY_STATE.OPEN) {
|
if (state === READY_STATE.OPEN) {
|
||||||
clearReconnectTimer();
|
clearReconnectTimer();
|
||||||
scheduleReconnectReset();
|
scheduleReconnectReset();
|
||||||
|
reconnectExhaustedRef.current = false;
|
||||||
identificationStartedRef.current = false;
|
identificationStartedRef.current = false;
|
||||||
setConnected(true);
|
setConnected(true);
|
||||||
setIdentified(false);
|
setIdentified(false);
|
||||||
|
|
@ -379,7 +383,7 @@ export function Provider(props: {
|
||||||
* @returns Promise that resolves after one connection attempt.
|
* @returns Promise that resolves after one connection attempt.
|
||||||
*/
|
*/
|
||||||
async function connect() {
|
async function connect() {
|
||||||
if (disposed) {
|
if (disposed || reconnectExhaustedRef.current) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue