LibreChat/packages/api/src/utils
Marco Beretta 5b4ec6bfe2
🔎 feat: Filter and Sort the Sidebar Chats List (#15842)
* 🔎 feat: Filter and Sort the Sidebar Chats List

The sidebar could only list every unarchived chat by last activity. Archived chats
lived behind a settings modal, sorting was not exposed at all, and the only filter
was a bookmark dropdown squeezed next to the search field.

A single control beside the Chats heading now carries the status (active or
archived), the sort field and direction, and the bookmark filter, each scoped to
that list alone: Projects, Pinned and Favorites are untouched by it.

* 🧹 fix: Answer Review Round on Sidebar Chat Filters

Rows derive their archive action from `conversation.isArchived`, which the list
projection now carries, instead of from the sidebar's filter mode: the archive view
keeps the unarchived pins beside it, and its previous page's rows outlive a status
switch, so the list mode offered to restore chats that were never archived.

Mutations reconcile the archived list caches they can now reach — rename, pin,
tags, project assignment, shared links — and archiving refetches the archived
query instead of inserting into page one, which dropped the row whenever the
active sort placed it later.

Title grouping keeps the order the server paged, heads each group with the title's
first code point, and the archive's legacy group falls back to `createdAt` the way
the cursor orders it. A failed list request renders an error with Retry rather
than "No chats yet", the status setter sanitizes a malformed stored sort, and
signing into another account no longer inherits the previous one's filters.

* 🧵 fix: Keep Sidebar Cache Writes Inside the Chosen Sort

Title groups are emitted as contiguous runs, so a `#` heading that the server's
order places either side of a letter no longer merges and drags a row across the
cursor boundary the next page continues from.

The live cache writers only reproduce newest-first, which is the one order they can
place a row in without the server's keyset. A title, created-at or ascending variant
now takes the field update in place and is refetched instead of having rows moved to
or seeded at the front of page one.

Archive and restore refetch every loaded page of the lists they touch — the archive
preserves `updatedAt`, so a restored chat can belong on a later active page — while
inactive variants are left stale rather than eagerly refetched. Archiving everything
still refetches them all, because every cached list is wrong afterwards. Renaming or
deleting a bookmark now rewrites the sidebar's selected tags, which otherwise kept
filtering by a name no menu could uncheck.

* 🗂️ fix: Treat the Archived List as a Live Conversation Cache

* 🔍 fix: Refetch List Variants Whose Membership the Client Cannot Decide

A cached search result is evaluated by the server, so a newly created row may or may
not belong in it. Skipping those variants left a mounted search list missing a row
it should show — forking from an archived search result being the case that exposed
it. The insert decision is now three-valued: insert into a variant whose membership
and order the client can reproduce, skip one the row provably does not belong to,
and refetch anything undecidable.

Forks, duplicates and imports inherit the source's archive state, so their
invalidations cover the archived list too, and the delete path reads `chatProjectId`
from archived caches as well.

* 🔎 fix: Reconcile Searched List Variants on Every Write

* 📣 fix: Announce Archive and Restore From the App Live Region

* 🧹 fix: Drop Unmounted Lists on Archive-All and Fill a Missing Archive State

Archive-all refetched every loaded page of every cached list, mounted or not, so a
session that had visited several sort, bookmark or search combinations paid a burst of
requests for lists nobody was looking at. Mounted variants still refetch all pages;
the rest are dropped, which reconciles them more thoroughly than a refetch and costs
nothing until something mounts them.

A row's own `isArchived` decides whether its menu offers Archive or Restore, and this
branch is what adds that field to the list projection — so mid-rollout, an archived
row from an older backend would offer Archive and submit a no-op. The list query now
fills a missing value from what the variant asked for, leaving an explicit one alone.

* 🧭 fix: Give Callers One Way to Reconcile Both Conversation Lists

Callers that cannot say what changed — a stream recovered after a disconnect, a
schedule whose run moved a chat, a project that took its chats' fields with it — were
invalidating the active list by hand, so a mounted archive kept a row the server had
already changed. `invalidateConversationLists` reaches both prefixes and is now the
only way those paths reconcile; `findConversationListQueries` shares its key list, so
adding a prefix is one edit rather than a sweep.

* 🔤 fix: Follow the Server Order, Index the Created Sort, and Tell the Truth When Empty

* 🎯 fix: Identify the Open Chat When a Restore Resolves

A restore leaves the chat open, so its success callback writes the new archive state
into the active conversation — but the callback captured that conversation when the
menu item was clicked. Open another chat before the request lands and the identity
check still matched the captured row, replacing the conversation the user had just
opened while the URL kept pointing at it.

The write is now a functional update that compares `conversationId` against current
state, so a stale callback leaves the open chat alone. Reading the conversation value
is no longer needed either, which also stops every row's menu from re-rendering on
conversation updates.

* 🧷 fix: Recheck the Open Route When an Archive Resolves
2026-09-12 15:56:10 -04:00
..
__tests__
axios.spec.ts
axios.ts 🛟 fix: Recover CodeAPI File Uploads After Throttling (#15784) 2026-09-09 15:48:11 -04:00
azure.spec.ts
azure.ts
code.spec.ts 🛟 fix: Recover CodeAPI File Uploads After Throttling (#15784) 2026-09-09 15:48:11 -04:00
code.ts 🛟 fix: Recover CodeAPI File Uploads After Throttling (#15784) 2026-09-09 15:48:11 -04:00
common.spec.ts 🈳 fix: Treat Blank Mongo Index Settings as Unset (#15809) 2026-09-09 23:24:18 -04:00
common.ts 🈳 fix: Treat Blank Mongo Index Settings as Unset (#15809) 2026-09-09 23:24:18 -04:00
content.spec.ts 📭 fix: Drop Empty Summary Parts Before Persistence (#15338) 2026-08-29 17:24:35 -04:00
content.ts 📭 fix: Drop Empty Summary Parts Before Persistence (#15338) 2026-08-29 17:24:35 -04:00
email.ts
env.spec.ts 🔒 fix: Refresh MCP OBO Tokens From the Live OpenID Session (#15334) 2026-08-29 23:55:58 -04:00
env.ts 🪪 fix: Reject ID Tokens as the OpenID Bearer Reuse Access Token (#15317) 2026-08-28 10:11:32 -04:00
errors.spec.ts 🔣 fix: Encode Images From Storage Keys (#15851) 2026-09-12 12:39:26 -04:00
errors.ts 🔣 fix: Encode Images From Storage Keys (#15851) 2026-09-12 12:39:26 -04:00
events.ts
files.spec.ts 🛂 feat: Filter Model-Bound Content by Source (#14425) 2026-08-21 22:43:32 -04:00
files.ts 🫙 fix: Surface Document Extraction Failures (#15651) 2026-09-06 19:09:49 -04:00
generators.ts 🌊 feat: Wire Adaptive Stream Smoothing Across Google, Bedrock, and Zero-Disable Semantics (#14660) 2026-08-06 12:39:12 -04:00
graph.spec.ts
graph.ts
headers.spec.ts 🪪 feat: Propagate Tenant to Agent Model Headers (#15521) 2026-09-02 13:25:38 -04:00
headers.ts 🪪 feat: Propagate Tenant to Agent Model Headers (#15521) 2026-09-02 13:25:38 -04:00
http.ts
identity.spec.ts 🔒 fix: Refresh MCP OBO Tokens From the Live OpenID Session (#15334) 2026-08-29 23:55:58 -04:00
identity.ts 🔒 fix: Refresh MCP OBO Tokens From the Live OpenID Session (#15334) 2026-08-29 23:55:58 -04:00
import.ts
index.ts 🗜️ fix: Bound Conversation Page Size (#15576) 2026-09-03 23:52:36 -04:00
key.test.ts
key.ts
latex.spec.ts
latex.ts
llm.test.ts 🖍️ fix: Honor Agent Image Detail Settings (#15407) 2026-08-31 08:34:05 -04:00
llm.ts 🖍️ fix: Honor Agent Image Detail Settings (#15407) 2026-08-31 08:34:05 -04:00
math.integration.spec.ts
math.spec.ts
math.ts
memory.ts
message.spec.ts
message.ts
oidc.spec.ts 🪪 fix: Reject ID Tokens as the OpenID Bearer Reuse Access Token (#15317) 2026-08-28 10:11:32 -04:00
oidc.ts 🔒 fix: Refresh MCP OBO Tokens From the Live OpenID Session (#15334) 2026-08-29 23:55:58 -04:00
openid.spec.ts 🔐 fix: Keep OpenID Metadata Out of Logs and Traces (#15470) 2026-09-01 13:22:12 -04:00
openid.ts 🔐 fix: Keep OpenID Metadata Out of Logs and Traces (#15470) 2026-09-01 13:22:12 -04:00
parity.spec.ts 🪟 fix: Resolve Context Windows and Pricing for Newer Model Families (#14877) 2026-08-16 16:41:02 -04:00
path.spec.ts
path.ts
pluginEnv.spec.ts 🔌 feat: Add Agent Plugins (Experimental) (#14704) 2026-08-09 08:10:22 -04:00
ports.spec.ts
ports.ts
promise.spec.ts
promise.ts
promises.spec.ts 🛑 fix: Forward Run Abort Signal to Foreground Tool Calls (#15517) 2026-09-02 13:32:33 -04:00
promises.ts 🛑 fix: Forward Run Abort Signal to Foreground Tool Calls (#15517) 2026-09-02 13:32:33 -04:00
proxy.spec.ts
proxy.ts
query.spec.ts 🔎 feat: Filter and Sort the Sidebar Chats List (#15842) 2026-09-12 15:56:10 -04:00
query.ts 🔎 feat: Filter and Sort the Sidebar Chats List (#15842) 2026-09-12 15:56:10 -04:00
quotes.spec.ts
quotes.ts 🛂 feat: Filter Model-Bound Content by Source (#14425) 2026-08-21 22:43:32 -04:00
sanitizeTitle.spec.ts
sanitizeTitle.ts
text.spec.ts
text.ts 🧵 feat: Background Tool Calls for Agents & Model Specs (#14197) 2026-07-13 12:51:36 -04:00
tokenizer.spec.ts 🧢 fix: Bound Tokenizer Work Per Input (#15246) 2026-08-26 07:37:19 -04:00
tokenizer.ts 🧢 fix: Bound Tokenizer Work Per Input (#15246) 2026-08-26 07:37:19 -04:00
tokenMap.ts
tokens.spec.ts 🌌 feat: Add GPT-6 Astra Support (#15567) 2026-09-04 10:23:29 -04:00
tokens.ts 🌌 feat: Add GPT-6 Astra Support (#15567) 2026-09-04 10:23:29 -04:00
tracing.ts
url.spec.ts
url.ts
yaml.ts