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

refactor: use Metro HMR socket to listen for changes #65

Merged
merged 6 commits into from
Jul 16, 2024

Conversation

byCedric
Copy link
Member

@byCedric byCedric commented Jul 15, 2024

Fixes #60

This resolves an issue where .getBundler().getDelta() actually resets the information before the HMR server loads the delta information. It results in the clients not being updated.

The new system uses the <metroUrl>/hot to listen for any changes in the web UI. Unfortunately, Metro's HMR system is very limited, and it only provides a module ID. This means that we can't match per-path anymore, as resolving a module ID to a module path is impossible.

When a change is detected, it will check if we can auto-update. If so, we'll ask Atlas to reload the data through all bundles serializerOptions.sourceUrl. If that doesn't exist, e.g. for server bundles, we can't update the data.

Preferably, we'd be able to hook into Metro better to listen for changes on the server and update automatically, without the Atlas webui being open. But, that's not possible atm without using private APIs.

@byCedric byCedric marked this pull request as ready for review July 15, 2024 13:17
@byCedric byCedric requested a review from EvanBacon July 15, 2024 13:18
Copy link

@EvanBacon EvanBacon left a comment

Choose a reason for hiding this comment

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

haha sure, looks a bit more reasonable now.

@byCedric byCedric merged commit fe7fc4f into main Jul 16, 2024
2 checks passed
@byCedric byCedric deleted the @bycedric/refactor/use-hmr-client branch July 16, 2024 10:08
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.

Breaks live updates when developing
2 participants