-
Notifications
You must be signed in to change notification settings - Fork 18
feat: chat_restore() replaces chat_enable_bookmarking()
#82
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
Conversation
chat_restore() replaces chat_enable_bookmarking()
| chat_clear(id) | ||
| client_set_ui(client, id = id) | ||
| shiny::withReactiveDomain(session, { | ||
| chat_clear(id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this also clear starting messages (i.e., chat_ui(messages = list(...)))?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point and yeah, that's true. I've updated the docs of chat_mod_ui() to clarify that messages only applies when the client doesn't have any history. And left a similar note in the chat_restore() docs.
Replaces
chat_enable_bookmarking()withchat_restore(), which now also restores the message history either from the bookmark or from the messages onclientwhen passed in.@schloerke and I paired through getting
chat_enable_bookmarking()to work inside modules. Along the way, we realized that it'd be best for this function to also handle setting UI state from the message history attached to the chatclient, in particular because we only want to perform that restore if we're not restoring from a bookmark.This change meant that
chat_enable_bookmarking()was not quite accurately named. Also, becausechat_enable_bookmarking()still requiresenableBookmarkingto be turned on in the Shiny app,chat_restore()feels a bit more generally appropriate.We also now turn on bookmarking in
chat_app()and we also avoid the issues described in #71.Finally,
chat_mod_server()gains thebookmark_on_*arguments ofchat_restore()and does the restoration automatically. And we deprecateclientinchat_mod_ui()because this is now handled entirely on the server.Implementation note: this PR includes a
contents_shinychat()placeholder that will be replaced withcontents_shinychat()in #52.