Skip to content
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

fix: Display error if port is already in use #1335

Merged
merged 4 commits into from
Dec 8, 2023
Merged

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 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.

connections: Connection[]
selectedClientId: string
orphanedCommands: any[] // Command[]
commandListeners: ((command: any) => void)[] // ((command: Command) => void)[]
}

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.

@@ -12,38 +12,32 @@ import { createServer } from "reactotron-core-server"
// configure a server
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
1 check passed
@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