-
-
Notifications
You must be signed in to change notification settings - Fork 172
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
Improve DX around version mismatch warnings #641
Conversation
✅ Deploy Preview for stimulusreflex ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
someone other than me will want to give an approval bc this is the first PR I've looked at in awhile but only one thing came to mind. this is pretty slick 👏 Whish rails had done this with webpacker.
Still need to review the code, but this is lovely. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏🏻 Love it! I'm not the biggest fan of adding more dependencies but agree that it's worth it in this case to enhance DX given that it's so minimal.
f1eba2d
to
a35fa9a
Compare
#651) Following up on #641 and #650, this pull request also shows version mismatch toasts when the CableReady versions don't match. Perviously it would just show toast messages when the StimulusReflex versions didn't match. ## Why should this be added Previously this just showed a console error message when the user enabled the client-side `debug` option to `true`. Now this message is always printed, regular of the option. But additionally it now shows a version mismatch toast message when the `debug` option is set to `true`: ![Screenshot 2023-03-27 at 21 10 36](https://user-images.githubusercontent.com/6411752/228042658-ed9523cc-575d-47b3-aaf0-6ab33a47b140.png) This helps to know what's up and why a reflex action might not have worked. If you didn't have the console open you wouldn't know why the reflex action didn't work.
Type of PR
Enhancement
Description
This pull request enhances the developer experience when the StimulusReflex client- and server-side versions mismatch. It will show a toast message in the lower right corner of the screen if there's a version mismatch. Previously it would just show it in the Rails server log.
It will only show the toasts if you try to trigger a reflex action, it won't complain earlier, which is also much friendlier, because in previous versions of StimulusReflex it wouldn't even let you start the Rails server.
This is what happens now if you try to trigger a reflex:
on
:exit
it will show a red error toast message and won't execute the trigged reflex:on
:warn
it will show a yellow warning toast message but will still execute the triggered reflex:on
:ignore
it won't show anything and also will also regularly execute the triggered reflex.Note: the
toastify-js
dependency will be bundled up with the built JavaScript version of the package, so it won't show up as a runtime dependency in applications running thestimulus_reflex
npm package.The toasts are currently not disabled in production environments, but I'm also not sure if we should. Any opinions on this?
Why should this be added
Improves the developer experience and makes it easier to noticed/work with.
Checklist