Skip to content

fix(react): stop infinite autoRetry loop and unhandled rejections in useMessage (#307) - #319

Open
KrazyArcher wants to merge 1 commit into
hanzoai:mainfrom
KrazyArcher:fix-issue-307
Open

KrazyArcher wants to merge 1 commit into
hanzoai:mainfrom
KrazyArcher:fix-issue-307

Conversation

@KrazyArcher

Copy link
Copy Markdown

Fixes #307

Summary

  • Separates initial sendMessage(content) calls (which reset retryCountRef.current = 0) from internal executeSend(content, true) retry invocations so retryCountRef.current increments up to maxRetries instead of resetting on every retry.
  • Ensures linear backoff (retryDelay * retryCountRef.current) progresses as 1x, 2x, ... maxRetries and stops after maxRetries attempts.
  • Catches background promise rejections inside the setTimeout auto-retry callback to prevent unhandled promise rejections while still updating error state and calling onError.

Verification

  • node --test pkg/react/src/hooks/useMessage.test.mjs -> Passed ✅

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

useMessage autoRetry never stops: the retry counter is reset on every retry

1 participant