-
-
Notifications
You must be signed in to change notification settings - Fork 716
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 exception handling associated with subs #633
Comments
@olivergeorge |
This repro was done using vanilla clojurescript REPL (as per the getting started guide). I think it's good to consider the REPL experience rather than relying on hooks associated with hot-reloading. From the REPL I can call |
Here's a concrete suggestion. What if the cache invalidated when a subscription was re-registered. The cache should definitely not be trusted in this case since the subscriptions would be out of sync. The old "warning: re-registering handler" message is gone but how about in it's place we invalidate the cache when it's a subscription re-register. If this was implemented there would be one less "setup step" for effective re-frame development and the REPL experience would be more seamless. |
Thinking about possible complexities / side effects... Clearing the subscription cache doesn't appear to trigger a re-render of the app. We can clear the cache without other code running (good) but that seems to imply we'd still need a hot-reload hook to tell the app to refresh itself. |
Here's a possible approach which modifies |
This code will throw errors due to the registered sub handler throwing an exception. The exception gets cached so that the same error appears after fixing and re-registering the sub at the repl.
In order to repeat remove the assert or register a new sub which doesn't throw then re-render the app.
The workaround is calling
clear-subscription-cache!
.Ideas to improve this behaviour and make it less surprising
The text was updated successfully, but these errors were encountered: