Skip to content

refactor: rename chat_greeting() dismissible to persistent#263

Merged
gadenbuie merged 9 commits into
mainfrom
fix/260-rename-chat-greeting-persistent
Jun 25, 2026
Merged

refactor: rename chat_greeting() dismissible to persistent#263
gadenbuie merged 9 commits into
mainfrom
fix/260-rename-chat-greeting-persistent

Conversation

@gadenbuie

Copy link
Copy Markdown
Collaborator

Closes #260

Summary

Renames the dismissible parameter on chat_greeting() to persistent across the JS client, Python package, and R package. The old name implied a user-controlled close button that never existed — dismissal is entirely automatic. persistent is unambiguous: persistent = FALSE (the default) means the greeting hides on first activity; persistent = TRUE keeps it visible throughout the conversation.

Polarity is inverted from the old default: dismissible = TRUE (hide) → persistent = FALSE (hide); dismissible = FALSE (stay) → persistent = TRUE (stay).

Both R and Python include deprecation shims so existing code using dismissible warns rather than breaks. In R, lifecycle::deprecate_warn("0.4.1", ...) is used with lifecycle::deprecated() as the sentinel default; in Python, the project's existing DEPRECATED/DEPRECATED_TYPE sentinel pattern is used. Both persistent and dismissible are placed after .../* so they must be passed by name — positional calls will error with a clear message.

The wire format key sent from R/Python to the JS component also changes from "dismissible" to "persistent".

Verification

library(shinychat)

# Default: greeting hides after first message (unchanged behavior)
chat_greeting("## Welcome!")

# Persistent: stays visible throughout
chat_greeting("Please read our terms.", persistent = TRUE)

# Old code: warns and maps correctly
chat_greeting("Please read our terms.", dismissible = FALSE)
#> Warning: `chat_greeting(dismissible)` was deprecated in shinychat 0.4.1.
#> Use `chat_greeting(persistent)` instead.

The `dismissible` parameter implied a user-closeable button that never
existed. Renaming to `persistent` makes the behavior unambiguous: the
greeting hides on activity by default (`persistent = FALSE/False`), or
stays pinned when `persistent = TRUE/True`.

Deprecation shims are in place for both R and Python so existing code
using `dismissible` will warn rather than break. The polarity is inverted:
`dismissible = FALSE` (stay visible) → `persistent = TRUE`.

Closes #260
…ting()

- Correct version to 0.4.1 (was incorrectly set to 0.3.0; dismissible
  was introduced in 0.4.0)
- Add @param ... roxygen entry with lifecycle badge documenting the
  deprecated dismissible argument
- Add rlang::check_dots_empty() to catch unknown extra arguments
Move dismissible behind ... so it must be named, use lifecycle::deprecated()
as the default and lifecycle::is_present() to detect use, and call
check_dots_empty() to guard against unknown args.
Replace **kwargs approach with explicit dismissible: DEPRECATED_TYPE = DEPRECATED
parameter in both ChatGreeting.__init__ and chat_greeting(), matching the
existing pattern used elsewhere in the codebase.
…ng()

Move persistent behind ... so positional calls like chat_greeting('Hi', FALSE)
hit check_dots_empty() and error clearly rather than silently binding to the
wrong parameter.
@gadenbuie gadenbuie marked this pull request as ready for review June 24, 2026 15:52
@gadenbuie gadenbuie requested a review from cpsievert June 24, 2026 15:52
Replace em dash in deprecation string with \u2014 escape and comment
hyphens with ASCII. Add @importFrom shiny isolate for bare isolate()
calls in chat_mod_server.
@gadenbuie gadenbuie merged commit 1563ed8 into main Jun 25, 2026
16 of 18 checks passed
@gadenbuie gadenbuie deleted the fix/260-rename-chat-greeting-persistent branch June 25, 2026 15:53
cpsievert added a commit that referenced this pull request Jun 25, 2026
Picks up the dismissible→persistent rename from origin/main (#263) into
all dist/www copies after rebasing feat/chat-history onto main.
@gadenbuie

Copy link
Copy Markdown
Collaborator Author

FYI I incorrectly had shinychat throw if both dismissible and persistent were included; I added 0e6c1e0 to main to revert that and to only warn about dismissible being deprecated when persistent is not included.

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.

Rename chat_greeting's dismissible to persistent: the current name implies a close button that doesn't exist

2 participants