This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
I’ve updated the statecharts library to have a hook for co-locating a statechart with a component. There is a simple example in the documentation. https://fulcrologic.github.io/statecharts/#_react_hooks
Hi all. It looks as if a component's :will-leave function is only called if the ident changes. That means my :will-leave is called if the user clicks on a link that routes to a component with a different ident, but :will-leave is not called if a user routes to a component with the same ident first and then onwards. I could do the necessary clean-up in the :will-enter instead, but is this :will-leave behaviour intended?
Thank you @U0CKQ19AQ - would it be helpful to try to create a minimal reproducing example, or is it clear from your knowledge of how things work that routing to a new component with same ident would do this. ie: do I need to double-check or prove this behaviour?
A minimal repro case would make it faster to fix, but no, you don’t have to prove it to me. It just isn’t a high priority for me to fix right now.
In https://book.fulcrologic.com/#_deferred_routing it says
The will-enter method MUST return the value of a call to either route-immediate or route-deferred.
but the example given may return nil
, so it's a call to either route-immediate or route-deferred or nil?Technically returning nil will cause the route to fail, but in the case where the parameters are not parseable for some reason, there’s no much more you can do. You’re getting input from an “unknown” source and trying to turn it into an ident. If you can’t do that, you simply can’t. Any internal use should never fail (unless you have a bug), but since you might derive the route params from user input (i.e. the URL) it is possible to have an error. In general any code that converts URLs into route segments should be careful to validate the user inputs so you can give reasonable errors.
In my case will-enter is called multiple times and the first few calls there is no params