Skip to content

docs(genai-tools): Set the reactive value directly from a tool - #487

Draft
jat255 wants to merge 1 commit into
mainfrom
jat255/reactive-lock-deprecation
Draft

jat255 wants to merge 1 commit into
mainfrom
jat255/reactive-lock-deprecation

Conversation

@jat255

@jat255 jat255 commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

This updates the tool-calling docs for the deprecation of reactive.lock(). A tool now sets a reactive value directly, with no lock and no flush.

Do not merge until a py-shiny release includes posit-dev/py-shiny#2508 and posit-dev/py-shiny#2520. In the released Shiny, a set() from a background task does not schedule a flush, so this example would not update the dashboard.

Summary

  • The update_dashboard() example in docs/genai-tools.qmd calls current_query.set(query) and nothing else.
  • The "Reactive locking" callout is replaced. The new callout says that a tool in a non-blocking stream can set a reactive value directly, because setting a value schedules a reactive update.

Review Notes

  • This is the only page in the site that uses reactive.lock() or reactive.flush(). The API reference pages come from py-shiny's docstrings, and those are updated in feat(reactive): Deprecate reactive.lock() py-shiny#2520.
  • The callout no longer mentions blocking streams, because the same code is now correct in both kinds of stream.

Testing

I did not render the site. The change is a code block and a callout in one .qmd file.

Refs posit-dev/py-shiny#698, posit-dev/py-shiny#2508, posit-dev/py-shiny#2520

reactive.lock() is deprecated (posit-dev/py-shiny#2520) and setting a
value schedules a flush (posit-dev/py-shiny#2508), so the
update_dashboard() example no longer takes the lock or flushes.

This branch was successfully deployed

1 active deployment
pr-487 — 52b0ca0d Deployed Oct 2, 2026 by github-actions[bot]
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

Successfully merging this pull request may close these issues.

1 participant