Skip to content
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

@If handle decorator ignored #1351

Open
1 of 4 tasks
jrglg opened this issue Jun 13, 2022 · 0 comments
Open
1 of 4 tasks

@If handle decorator ignored #1351

jrglg opened this issue Jun 13, 2022 · 0 comments

Comments

@jrglg
Copy link
Contributor

jrglg commented Jun 13, 2022

I'm submitting a...

  • Bug report
  • Feature request
  • Documentation issue or request
  • Other... Please describe:

Expected Behavior

Having this request:

{
   "handler":{
      "name":"Jovo"
   },
   "intent":{
      "name":"",
      "params":{
         "selected_option":{
            "original":"",
            "resolved":"1"
         }
      },
      "query":"Calculus exam"
   },
   "scene":{
      "name":"Main",
      "slotFillingStatus":"COLLECTING",
      "slots":{
         "selected_option":{
            "mode":"REQUIRED",
            "status":"SLOT_UNSPECIFIED",
            "updated":true,
            "value":"1"
         }
      }
   },
   "session":{
      "id":"ABwppHF6PnY5FSGbDf492nnNzVrGeoZK0mF9FI0jHcCw9DoH6-IZ1d2jfv7eWoCwRJRbnRXGpv2N",
      "params":{
         "state":[
            {
               "component":"SomeComponent"
            },
            {
               "resolve":{
                  "HELP":"HelpIntent",
                  "BACK":"BackIntent"
               },
               "component":"SomeComponent.NestedComponent"
            }
         ],
         "updatedAt":"2022-06-13T11:19:06.396Z",
         "isNew":false,
         "createdAt":"2022-06-13T10:56:12.660Z",
         "_GOOGLE_ASSISTANT_REPROMPTS_":{
            "NO_INPUT_1":"Doesn't matter.",
            "NO_INPUT_2":"Doesn't matter.",
            "NO_INPUT_FINAL":"Doesn't matter."
         },
         "id":"ABwppHF6PnY5FSGbDf492nnNzVrGeoZK0mF9FI0jHcCw9DoH6-IZ1d2jfv7eWoCwRJRbnRXGpv2N"
      },
      "typeOverrides":[
         
      ],
      "languageCode":""
   },
   "user":{
      "locale":"en-GB",
      "params":{
         "_GOOGLE_ASSISTANT_USER_ID_":"0f20db70-cb27-4901-b68b-9562c6addf99"
      },
      "accountLinkingStatus":"NOT_LINKED",
      "verificationStatus":"VERIFIED",
      "packageEntitlements":[
         
      ],
      "gaiamint":"",
      "permissions":[
         
      ],
      "lastSeenTime":"2022-06-13T11:17:10Z"
   },
   "home":{
      "params":{
         
      }
   },
   "device":{
      "capabilities":[
         "SPEECH",
         "RICH_RESPONSE",
         "LONG_FORM_AUDIO"
      ],
      "timeZone":{
         "id":"Europe/Madrid",
         "version":""
      }
   }
}

I expect Jovo to match it to this handler:

@Handle({
  if: (jovo: Jovo) => jovo.$entities.selected_option?.id != null,
  platforms: ['googleAssistant'],
})
Choose(): Promise<void> {
...
}

Current Behavior

It is routing the request to UNHANDLED handler in SomeComponent.NestedComponent.

No sense to me. If I restrict UNHANDLED with some decorators, then it goes to global UNHANDLED.

Using prioritizedOverUnhandled: true doesn't help.

SomeComponent.NestedComponent doesn't require much code... only the Choose handler from above.

The Route object is always the same: UNHANDLED of SomeComponent.NestedComponent if it is not restricted, or Global UNHANDLED.

UPDATE:

This works, but why?

@Handle(GoogleAssistantHandles.onScene('Main'))
@If( (jovo: Jovo) => jovo.$entities.selected_option?.id != null)
Choose(): Promise<void> {
...
}

To me, @if decorator should be enough.

Your Environment

  • Jovo Framework version used: latest
  • '@jovotech/platform-googleassistant': ^4.2.17
  • Operating System: Win10
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

No branches or pull requests

1 participant