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

Add new refresh config #142

Merged
merged 6 commits into from
Feb 5, 2024
Merged

Add new refresh config #142

merged 6 commits into from
Feb 5, 2024

Conversation

lxsmnsyc
Copy link
Member

@lxsmnsyc lxsmnsyc commented Jan 24, 2024

This PR adds the refresh option. Here are the following reasons:

  • Aims to allow defining custom render and createContext. SolidStart would highly benefit on this given that it wraps it with mount.
  • Aims to deprecate hot option. (not remove it)
  • Since 0.7.0, granular mode is now enabled by default, but there's no configurable way to disable it in Vite plugin.

src/index.ts Outdated
@@ -255,7 +260,7 @@ export default function solidPlugin(options: Partial<Options> = {}): Plugin {
},

configResolved(config) {
needHmr = config.command === 'serve' && config.mode !== 'production' && options.hot !== false;
needHmr = config.command === 'serve' && config.mode !== 'production' && (options.hot !== false && !options.refresh.disabled);

Choose a reason for hiding this comment

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

!options.refresh.disabled -> !options.refresh?.disabled

The refresh object isn't guaranteed:

Screenshot 2024-01-25 at 2 30 17 PM

Copy link

@marbemac marbemac Jan 25, 2024

Choose a reason for hiding this comment

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

Ditto the other spots further down that reach into the refresh object.

Might make sense to flip strict to true in the tsconfig to catch this kind of thing? Or at least strictNullChecks.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks! missed that minor detail

@ryansolid ryansolid merged commit 4990bab into master Feb 5, 2024
@lxsmnsyc lxsmnsyc deleted the refresh-api branch February 6, 2024 02:15
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.

3 participants