Skip to content
This repository has been archived by the owner on Jun 29, 2023. It is now read-only.

feat: add "--open" option to dioxus serve #136

Merged
merged 3 commits into from
May 2, 2023
Merged

feat: add "--open" option to dioxus serve #136

merged 3 commits into from
May 2, 2023

Conversation

arqalite
Copy link
Contributor

This PR adds the "--open" CLI parameter to the "serve" option, allowing the CLI to open the app in the user's default browser.

dioxus serve --open will open the app in the default browser.
dioxus serve --open --hot-reload will do the same, but with hot-reloading active.

This is just a nice-to-have feature that Trunk has and that I kind of miss since switching to Dioxus CLI.

This may introduce a bug in certain systems where the browser starts too early and times out as the server hasn't finished starting, meaning the user will have to manually refresh once the server starts.

A fix would involve starting the server, then probing the URL to see what response it returns before actually opening the browser (but that would require spawning a separate process/thread and adding too much complexity IMO, but let me know if you want me to add this.)

@arqalite arqalite changed the title feat: add "--open" option to CLI serve feat: add "--open" option when using dioxus serve Apr 30, 2023
@arqalite arqalite changed the title feat: add "--open" option when using dioxus serve feat: add "--open" option to dioxus serve` Apr 30, 2023
@arqalite arqalite changed the title feat: add "--open" option to dioxus serve` feat: add "--open" option to dioxus serve Apr 30, 2023
Copy link
Member

@mrxiaozhuox mrxiaozhuox left a comment

Choose a reason for hiding this comment

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

Great! I have updated the docs in your PR!

@mrxiaozhuox mrxiaozhuox merged commit ffb43e1 into DioxusLabs:master May 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants