feat: implement terminal reconnection UI components (Phase 2) by BrunoQuaresma · Pull Request #18695 · coder/coder · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

feat: implement terminal reconnection UI components (Phase 2) #18695

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

BrunoQuaresma
Copy link
Collaborator

  • Create TerminalRetryConnection component with countdown display and retry button
  • Add comprehensive Storybook stories covering all retry states
  • Integrate component with TerminalAlerts for proper positioning
  • Use consistent TerminalAlert styling for seamless integration
  • Ensure proper resize handling through existing MutationObserver

Implements Phase 2 of terminal reconnection feature as outlined in: coder/internal#659

blink-so bot and others added 7 commits July 1, 2025 14:06
- Update ConnectionStatus type: replace 'initializing' with 'connecting'
- Create useRetry hook with exponential backoff logic
- Add comprehensive tests for useRetry hook
- Export useRetry from hooks index

Implements:
- Initial delay: 1 second
- Max delay: 30 seconds
- Backoff multiplier: 2
- Max retry attempts: 10

Co-authored-by: BrunoQuaresma <3165839+BrunoQuaresma@users.noreply.github.com>
- Fix startRetrying to immediately perform first retry
- Adjust retry scheduling conditions
- Fix delay calculation for exponential backoff

Still debugging test failures
- Fix attemptCount to represent attempts started, not completed
- Fix exponential backoff delay calculation
- Fix retry scheduling conditions for proper max attempts handling
- All 10 useRetry tests now pass
- No regressions in existing test suite

Implements correct behavior:
- attemptCount increments when retry starts
- Exponential backoff: 1s, 2s, 4s, 8s, 16s, 30s (capped)
- Respects maxAttempts limit
- Manual retry cancels automatic retries
- State resets properly on success

Co-authored-by: BrunoQuaresma <3165839+BrunoQuaresma@users.noreply.github.com>
- Add parentheses around arrow function parameter
- Fix indentation

Co-authored-by: BrunoQuaresma <3165839+BrunoQuaresma@users.noreply.github.com>
- Replace setTimeout/setInterval with window.setTimeout/window.setInterval
- Replace clearTimeout/clearInterval with window.clearTimeout/window.clearInterval
- Fixes TypeScript error: Type 'Timeout' is not assignable to type 'number'
- Ensures proper browser environment timer types

Co-authored-by: BrunoQuaresma <3165839+BrunoQuaresma@users.noreply.github.com>
Convert useRetry hook from multiple useState calls to a single useReducer
for cleaner state management. This improves code clarity and makes state
transitions more predictable.

Changes:
- Replace 5 useState calls with single useReducer
- Add RetryState interface and RetryAction union type
- Implement retryReducer function for all state transitions
- Update all state access to use state object
- Replace setState calls with dispatch calls throughout

Co-authored-by: BrunoQuaresma <3165839+BrunoQuaresma@users.noreply.github.com>
- Create TerminalRetryConnection component with countdown display and retry button
- Add comprehensive Storybook stories covering all retry states
- Integrate component with TerminalAlerts for proper positioning
- Use consistent TerminalAlert styling for seamless integration
- Ensure proper resize handling through existing MutationObserver

Implements Phase 2 of terminal reconnection feature as outlined in:
coder/internal#659

Co-authored-by: BrunoQuaresma <3165839+BrunoQuaresma@users.noreply.github.com>
blink-so bot and others added 5 commits July 1, 2025 16:36
- Change 'import type { FC }' to 'import { type FC }' to match existing patterns
- Verified with prettier that formatting is correct

Co-authored-by: BrunoQuaresma <3165839+BrunoQuaresma@users.noreply.github.com>
…ectedAlert

- Simplify TerminalRetryConnection to show only retry status and button
- Keep existing DisconnectedAlert but add TerminalRetryConnection in actions
- Use TailwindCSS classes instead of CSS-in-JS
- Place retry component on the right side of the alert
- Make retry messages smaller and more concise
- Fix console.log usage in Storybook stories

Co-authored-by: BrunoQuaresma <3165839+BrunoQuaresma@users.noreply.github.com>
- Remove RefreshSessionButton from DisconnectedAlert actions
- Keep only TerminalRetryConnection component in the actions area
- Simplify the actions layout by removing the wrapper div

Co-authored-by: BrunoQuaresma <3165839+BrunoQuaresma@users.noreply.github.com>
@BrunoQuaresma BrunoQuaresma requested review from code-asher and a team July 1, 2025 17:00
Base automatically changed from feature/terminal-reconnection to main July 3, 2025 20:49
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.

1 participant

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.