🏷️ fix: Clear Model Spec Fields When Navigating with Non-spec Query Params#12274
Merged
Conversation
1 task
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a UI state bug where navigating to an agent share link while a modelSpec is selected can leave modelSpec-derived display fields (e.g., icon/label/greeting) stuck in the conversation state instead of showing the shared agent’s identity.
Changes:
- Updates
ChatRoute.getNewConvoPreset()to merge query-derived settings over the default modelSpec preset. - When query params override the conversation without explicitly setting
spec, clears select modelSpec display fields (spec,iconURL,modelLabel) from the merged preset to prevent stale UI carryover.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
4346e82 to
45f0779
Compare
…e Link - Extract `specDisplayFieldReset` constant and `mergeQuerySettingsWithSpec` utility to `client/src/utils/endpoints.ts` as a single source of truth for spec display fields that must be cleared on non-spec transitions. - Clear `spec`, `iconURL`, `modelLabel`, and `greeting` from the merged preset in `ChatRoute.getNewConvoPreset()` when URL query parameters override the conversation without explicitly setting a spec. - Also clear `greeting` in the parallel cleanup in `useQueryParams.newQueryConvo` using the shared `specDisplayFieldReset` constant. - Guard the field reset on `specPreset != null` so null values aren't injected when no spec is configured. - Add comprehensive test coverage for the merge-and-clear logic.
45f0779 to
b71fbbd
Compare
1 task
jcbartle
pushed a commit
to jcbartle/LibreChat
that referenced
this pull request
May 11, 2026
…e Link (danny-avila#12274) - Extract `specDisplayFieldReset` constant and `mergeQuerySettingsWithSpec` utility to `client/src/utils/endpoints.ts` as a single source of truth for spec display fields that must be cleared on non-spec transitions. - Clear `spec`, `iconURL`, `modelLabel`, and `greeting` from the merged preset in `ChatRoute.getNewConvoPreset()` when URL query parameters override the conversation without explicitly setting a spec. - Also clear `greeting` in the parallel cleanup in `useQueryParams.newQueryConvo` using the shared `specDisplayFieldReset` constant. - Guard the field reset on `specPreset != null` so null values aren't injected when no spec is configured. - Add comprehensive test coverage for the merge-and-clear logic.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #12272
Summary
I fixed a bug where navigating to an agent share link while a modelSpec was selected would leave stale modelSpec display data (icon, name, greeting) in the UI instead of showing the shared agent's information.
spec,iconURL, andmodelLabelfrom the merged preset inChatRoute.getNewConvoPreset()when URL query parameters override the conversation without explicitly setting a spec.specPresetis spread as a base and query settings (e.g.,agent_id) are overlaid on top — previously the spec's display fields persisted through the merge sinceareSettingsApplied()inuseQueryParamsskips checking those fields, so the safety-netnewQueryConvocall never fired.Change Type
Testing
modelSpecswithprioritize: falseand at least one spec (alldefault: false).?spec=specName— confirm spec icon/name/greeting load correctly.Checklist