Skip to content

Conversation

jamonholmgren
Copy link
Member

Fixes #1334.

This adds an icon to the left sidebar that indicates the server status: Stopped, Started, or Port Unavailable.

Server StartedPort 9090 Unavailable

Clicking the icon reloads Reactotron, which is a quick & dirty way to attempt reconnection. In the future, we can handle it more elegantly.

import LayoutContext from "../../contexts/Layout"
import StandaloneContext from "../../contexts/Standalone"

import SidebarStateless from "./Stateless"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really a fan of these Stateless.tsx files.

Copy link

sweep-ai bot commented Dec 7, 2023

Apply Sweep Rules to your PR?

  • Apply: All new business logic should have corresponding unit tests.
  • Apply: Refactor large functions to be more modular.
  • Apply: Add docstrings to all functions and file headers.


type Action =
| { type: ActionTypes.ServerStarted; payload: undefined }
| { type: ActionTypes.ServerStopped; payload: undefined }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I honestly think we should implement MobX-State-Tree in Reactotron. I am not a big fan of the useReducer & provider/context DX.

const server = createServer({
port: 9090, // default

onStart: () => null, // fires when we start the server
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These examples were wrong. I fixed them.

Copy link
Contributor

@joshuayoes joshuayoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran it locally, we are looking good!
Screenshot 2023-12-07 at 4 31 47 PM

@joshuayoes joshuayoes changed the title Fix #1334: Display error if port is already in use fix: Display error if port is already in use Dec 8, 2023
@jamonholmgren jamonholmgren merged commit e205e37 into master Dec 8, 2023
@jamonholmgren jamonholmgren deleted the feature/portInUse branch December 8, 2023 00:34
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.

Reactotron fails silently when port 9090 is already in use

2 participants