-
Notifications
You must be signed in to change notification settings - Fork 0
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
context lists don't update grammar when changed by an action #118
Comments
I'm having the same issue! from talon import app, Module, Context, actions, ui
from talon.voice import Capture
module = Module()
module.list("value", "some values")
@module.capture
def value(m) -> str: """print some value"""
context = Context()
context.lists["self.value"] = []
@context.capture(rule="{self.value}")
def value(m) -> str:
print("value: ", m.value)
return m.value
@module.action_class
class Actions:
def update(k: str, v: str) -> str:
"Updates the list"
context.lists["self.value"].update({k: v}) I have a command declared as: I can trigger the action from the repl: saying "test" will print "something", but only after having switched applications. One possible workaround for some use cases is to listen for a ui event and notify the list. def ui_event(event, argument):
print("Notifying list update")
context.lists = context.lists
ui.register('', ui_event) |
which version of talon have you most recently reproduced this in? does it repro in both the current public and the current beta? |
I just confirmed this is the case on the |
I just realized the underlying issue here. In-place mutation of word lists on contexts isn't supported. You're supposed to manage the list contents yourself and update the whole list at once. Good:
Bad:
The next beta release will throw this error for the Bad variant:
|
When I run this action, I can see that an additional entry has been added to the list as expected, but I can't get it to trigger in any rule which uses that new entry. Original entries in that list continue to work fine.
The text was updated successfully, but these errors were encountered: