-
-
Notifications
You must be signed in to change notification settings - Fork 308
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
Unhandled
and @PrioritizedOverUnhandled
handlers don't clean up the state stack correctly
#1211
Comments
Thank you for flagging this @jtfell! The |
@jankoenig @aswetlow Is there a function to clear the state stack? If in
And I also add a
Then in
Here is the response:
|
You can clear the state stack with That example looks interesting, we'll take a look. The I tend to think that, to solve this stacking problem, we should not only replace the "old" component with the new one when using |
I'm having this issue as well. I have all the packages updated to latest version. This is happening to me only in Google Assistant. Jovo Debugger and Alexa do clear the state correctly. My flow:
Note: neither |
Hey @jrglg |
Hi @aswetlow here you have it. You have to create a blank project named in gactions named 'test-state-redirect'. Then:
I hope you can test it with these files. If need another example let me know. UPDATE: Forgot to change Alexa locale (is not used in this example but maybe you do use it and fails for you) |
Hey @aswetlow Another example without delegating at the beggening. This one throws an error at runtime because can't find a handler in LovePizzaComponent. It is looking the wrong component. |
Thank you, this was helpful. I think I found a bug in our _mergeWith implementation: https://github.com/jovotech/jovo-framework/blob/v4/latest/platforms/platform-googleassistant/src/GoogleAssistantPlatform.ts#L71 I might have a fix, but I'm not sure of any side effects. Will do some tests and prepare a fix... |
🐛 Fix state stack merge on Google Assistant #1211
I encountered this problem as well, here are my thoughts I shared on Slack on how this could be handled:
This problem may be linked to #1380. |
I also feel like this should be changed... Component data is not as handy
as it should be.
El vie., 29 jul. 2022 15:28, Gianluca Acerbis ***@***.***>
escribió:
… I encountered this problem as well, here are my thoughts I shared on Slack
on how this could be handled:
I've a state stack that contains [ComponentA, ComponentA.ComponentB] (so I
delegated from ComponentA to ComponentB). If ComponentB has UNHANDLED and I
trigger an intent handled by ComponentA which has @PrioritizedOverUnhandled
annotation, the request is redirected to the handler in ComponentA as
expected, but the state stack becomes [ComponentA, ComponentA].
At this point, I can't access the data of the first ComponentA. The
resolve object from ComponentA.ComponentB is gone as well, so I can no
longer resolve the delegation and I'm stuck here.
In this case, since the request is handled by an handler of a component
which is part of the current state stack, wouldn't it make more sense to
just pop out ComponentB from the stack?
On the contrary, if the request was handled by a global handler of a root
component not in the current stack, it would have made sense to clear the
state stack (like this.$redirect), because we would have exited the stack
scope. What are your thoughts about this? And if this is by design, what's
the best way to detect this situation?
I think that the same happens in the following situations as well:
- ComponentB is a root component and not a subcomponent of ComponentA
(so the initial state would be [ComponentA, ComponentB] and not
[ComponentA, ComponentA.ComponentB]).
- ComponentB doesn't have UNHANDLED and you trigger a global handler
from a root component or another handler which is part of the current stack.
This problem may be linked to #1380
<#1380>.
—
Reply to this email directly, view it on GitHub
<#1211 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AMTE3JCZ6ZBGET4PSHVTIU3VWPMBBANCNFSM5NH47Y4Q>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I'm submitting a...
Expected Behavior
I'll use
@PrioritizedOverUnhandled
as the example here, but I believe this issue applies more generally when delegated components aren't explicitly resolved.If I have a handler with the
@PrioritizedOverUnhandled()
decorator for a specific intent and its called, the state stack is left in a way that breaks the$resolve
behaviour.See the reproduction here.
Current Behavior
I did this interaction through the debugger:
And saw this in the state stack. It did not find the handler in the
GlobalComponent
via theresolve
call inLoveHatePizzaComponent
It seems like this logic doesn't get called when routed in this way, and there is that extra
Error log
Your Environment
The text was updated successfully, but these errors were encountered: