coral-web: reset conversation on route change #275
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
AI Description
This pull request makes changes to the
SettingsDrawerandConversationcomponents in thecoral_webinterface, and also updates thechat.tsfile.Summary
SettingsDrawercomponent inSettingsDrawer.tsxhas been modified to include akeyprop for each tab'sdivelement, ensuring a unique identifier for efficient React rendering and reconciliation.Conversationcomponent inindex.tsxnow includes theresetConversationproperty from theuseConversationStorehook. It also updates theuseRouteChangehook to invokeresetConversationwhen the route changes.chat.tsfile has removed theuseRouterimport from 'next/router' and the associated usage ofuseRouterin theuseChatfunction.Details
SettingsDrawer.tsxandSettingsDrawer.tsxtabs.mapfunction now returns adivelement with a uniquekeyprop set tot.name. This ensures that each tab's content is wrapped in a distinct HTML element with a unique identifier, facilitating efficient rendering and updates in React.index.tsxresetConversationproperty is now destructured from theuseConversationStorehook.useRouteChangehook now takes an options object as an argument, with anonRouteChangeStartproperty that resets the conversation when the route changes.chat.tsuseRouterimport from 'next/router' has been removed, along with the usage ofuseRouterin theuseChatfunction.