mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-12 17:56:50 +00:00
* refactor: Move the Messages View Provider Into @librechat/chat * refactor: Render the Package Message List by Default in ChatScreen * fix: Drop the Rail's IntersectionObserver Guard for a Package Spec Stub Nothing renders the rail without a browser: its observer starts in an effect, which never runs in a server render. The guard existed only because jsdom lacks the API, so jsdom now gets inert observers and matchMedia from the package's jest setup, and the spec's own stubs, which no longer matched the DOM lib's IntersectionObserver type, are gone. * test: Scroll a Sidebar Row Into View Before Dragging It A row under the fold has no pixel the mouse can press, so the drag selected text instead. Whether a run hit it depended on which earlier specs shared its shard and left chats in the Running and Finished sections. * test: Give the Client Specs an Inert IntersectionObserver With the rail's guard gone, a client spec that renders the message list reaches the observer jsdom lacks. The shared setup provides an inert one, as the package's jest setup does, and the child-thread spec's partial client mock gains the rem scale hook the rail reads. * chore: Retest Against Current Dev * test: Give the Test Messages Host the Row Hook Members The messages host gained the assistant, added-conversation, streamed-attachment and feedback hooks when the row hooks moved into the package, so the shared test host supplies them too.
32 lines
935 B
JavaScript
32 lines
935 B
JavaScript
/** jsdom has no TextEncoder; the subagent reducers measure payload sizes with it. */
|
|
const { TextEncoder } = require('node:util');
|
|
|
|
if (typeof globalThis.TextEncoder === 'undefined') {
|
|
globalThis.TextEncoder = TextEncoder;
|
|
}
|
|
|
|
/** jsdom has no layout, so it ships none of the observers or media queries every browser has. The
|
|
* message list's rail and scroll control need them to mount; a spec about what they report
|
|
* installs its own. */
|
|
if (typeof window !== 'undefined') {
|
|
class InertObserver {
|
|
observe() {}
|
|
unobserve() {}
|
|
disconnect() {}
|
|
takeRecords() {
|
|
return [];
|
|
}
|
|
}
|
|
window.IntersectionObserver ??= InertObserver;
|
|
window.ResizeObserver ??= InertObserver;
|
|
window.matchMedia ??= (media) => ({
|
|
matches: false,
|
|
media,
|
|
onchange: null,
|
|
addListener() {},
|
|
removeListener() {},
|
|
addEventListener() {},
|
|
removeEventListener() {},
|
|
dispatchEvent: () => false,
|
|
});
|
|
}
|