Fix huge usage bandwidth and performance issue of pinned message banner. (#37)
* Return only the first 100 pinned messages * Execute pinned message 10 by 10
This commit is contained in:
parent
5740bdbd38
commit
6b384fe9c1
5 changed files with 100 additions and 11 deletions
|
@ -196,6 +196,21 @@ describe("<PinnedMessagesCard />", () => {
|
|||
expect(asFragment()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("should not show more than 100 messages", async () => {
|
||||
const events = Array.from({ length: 120 }, (_, i) =>
|
||||
mkMessage({
|
||||
event: true,
|
||||
room: "!room:example.org",
|
||||
user: "@alice:example.org",
|
||||
msg: `The message ${i}`,
|
||||
ts: i,
|
||||
}),
|
||||
);
|
||||
await initPinnedMessagesCard(events, []);
|
||||
|
||||
expect(screen.queryAllByRole("listitem")).toHaveLength(100);
|
||||
});
|
||||
|
||||
it("should updates when messages are pinned", async () => {
|
||||
// Start with nothing pinned
|
||||
const { addLocalPinEvent, addNonLocalPinEvent } = await initPinnedMessagesCard([], []);
|
||||
|
|
|
@ -358,7 +358,7 @@ exports[`<PinnedMessagesCard /> unpin all should not allow to unpinall 1`] = `
|
|||
aria-label="Open menu"
|
||||
class="_icon-button_bh2qc_17"
|
||||
data-state="closed"
|
||||
id="radix-18"
|
||||
id="radix-218"
|
||||
role="button"
|
||||
style="--cpd-icon-button-size: 24px;"
|
||||
tabindex="0"
|
||||
|
@ -424,7 +424,7 @@ exports[`<PinnedMessagesCard /> unpin all should not allow to unpinall 1`] = `
|
|||
aria-label="Open menu"
|
||||
class="_icon-button_bh2qc_17"
|
||||
data-state="closed"
|
||||
id="radix-19"
|
||||
id="radix-219"
|
||||
role="button"
|
||||
style="--cpd-icon-button-size: 24px;"
|
||||
tabindex="0"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue