Skip to content

Conversation

@jkone27
Copy link
Collaborator

@jkone27 jkone27 commented Jun 27, 2025

references issue #53

1 - in sample-project use fable Feliz latest instead of custom Nojaf react bindings, and added an imported component

image

2 - fix issue of unhandled asynchronous error crashing app in hmr transform in case of json rpc error (error is in emit), alrady logging warning mitigates the issue causing the plugin to keep working! just handling the exception gracefully - yay

2:51:33 PM [vite] [fable]: protocol: [fable] Protocol-level error from JSONRPCEndpoint: [transform] Received id mismatch! Got 19, expected 20

now this error is handled by just warning, thus not crashing the vite plugin in case of onhandled json rpc errors, but causing a full reload:

Screenshot 2025-06-27 at 14 52 18

<Compile Include="Math.fs" />
<Compile Include="Component.fsi" />
<Compile Include="Component.fs" />
<Compile Include="./components/TestComponent.fs" />
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added an external component as the issue only happens when there is at least one component importing another it seems, not only with a root component

@jkone27 jkone27 requested a review from nojaf June 27, 2025 13:06
### Fixed
- Bug fix targeting issue ([#53](https://github.com/fable-compiler/vite-plugin-fable/issues/53)) as log warn and no crash, for protocol error in json rpc serialization when there is id count mismatch
- removed Nojaf.React bindings nuget package and using Feliz instead for sample-project, as it is what is most used in community projects and suggested by official fable docs for React.
- pr ([#55](https://github.com/fable-compiler/vite-plugin-fable/pull/55))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added change log entries

else {
logError("unknown", `error: ${err}, ${err.code}, ${err.context ?? "no context"}`);
}
});
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated handling of error

<PackageReference Include="Fable.Browser.Dom" Version="2.14.0" />
<PackageReference Include="Fable.Core" Version="4.3.0" />
<PackageReference Include="Nojaf.Fable.React" Version="0.0.2" />
<PackageReference Include="Feliz" Version="2.9.0" />
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

update to standard fable Feliz remove Nojaf.Fable.React experimental package from sample

"type": "module",
"scripts": {
"dev": "bunx --bun vite",
"dev:debug": "VITE_PLUGIN_FABLE_DEBUG=1 bunx --bun vite",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added dev debug script

@jkone27
Copy link
Collaborator Author

jkone27 commented Jun 28, 2025

a possible version also: jkone27#2 , this one uses a queue to prevent concurrent changes race conditions in transform json rpc, + checks in vite hmr file changes if file actually didnt change using a hash from node crypto, if no changes, continues without recompiling

Copy link
Member

@nojaf nojaf left a comment

Choose a reason for hiding this comment

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

It seems like you're trying to accomplish two objectives in this PR, which makes it a bit confusing. There's the exception handling aspect and the porting to Feliz. It would be better to separate these two tasks.


## [0.2.1] - 2025-06-28
### Fixed
- Bug fix targeting issue ([#53](https://github.com/fable-compiler/vite-plugin-fable/issues/53)) as log warn and no crash, for protocol error in json rpc serialization when there is id count mismatch
Copy link
Member

Choose a reason for hiding this comment

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

This changelog entry lacks consistency. Please adhere to a uniform format and avoid trends.

Additionally, it appears that not many fixes are being made. This could be misleading for end-users, so I would prefer to follow the updates in your other PR.

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.

2 participants