Skip to content

fix: Composer AutoGrow causing the message list to shift#41007

Queued
MartinSchoeler wants to merge 2 commits into
developfrom
fix/composer-autogrow
Queued

fix: Composer AutoGrow causing the message list to shift#41007
MartinSchoeler wants to merge 2 commits into
developfrom
fix/composer-autogrow

Conversation

@MartinSchoeler

@MartinSchoeler MartinSchoeler commented Jun 18, 2026

Copy link
Copy Markdown
Member

Proposed changes (including videos or screenshots)

Issue(s)

CORE-2290

Steps to test or reproduce

Further comments

Review in cubic

Summary by CodeRabbit

  • Bug Fixes
    • Fixed message list shifting while typing in the fully expanded message composer.

@dionisio-bot

dionisio-bot Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@changeset-bot

changeset-bot Bot commented Jun 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: edc204b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@rocket.chat/meteor Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

useKeepAtBottom is refactored to extract a sendToBottom helper used by both the ResizeObserver callback and a new window input event listener. The listener fires sendToBottom when the input event target is inside .rc-message-box, preventing message list shifts while typing in the expanded composer. A changeset entry documents the patch.

Changes

useKeepAtBottom scroll fix

Layer / File(s) Summary
sendToBottom helper, ResizeObserver refactor, and input event wiring
apps/meteor/client/views/room/MessageList/hooks/useKeepAtBottom.ts, .changeset/famous-birds-join.md
Extracts a sendToBottom() helper that centralizes the isAtBottom check and handleRef invocation. The ResizeObserver callback is updated to call this helper directly. A new sendToBottomEvent handler is registered on window for input events and calls sendToBottom() when the target is inside .rc-message-box. Cleanup removes the listener alongside disconnecting the observer. The changeset declares a patch release for @rocket.chat/meteor.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

type: bug

Suggested reviewers

  • cardoso
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: Composer AutoGrow causing the message list to shift' directly and clearly describes the main bug fix in the changeset - addressing an issue where the Composer AutoGrow feature causes message list shifting.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • CORE-2290: Request failed with status code 401

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@MartinSchoeler MartinSchoeler marked this pull request as ready for review June 18, 2026 20:12
@MartinSchoeler MartinSchoeler requested a review from a team as a code owner June 18, 2026 20:12
@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.12%. Comparing base (6033e93) to head (edc204b).
⚠️ Report is 11 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #41007      +/-   ##
===========================================
- Coverage    70.13%   70.12%   -0.01%     
===========================================
  Files         3358     3359       +1     
  Lines       129563   129599      +36     
  Branches     22405    22467      +62     
===========================================
+ Hits         90866    90881      +15     
- Misses       35386    35408      +22     
+ Partials      3311     3310       -1     
Flag Coverage Δ
e2e 59.32% <80.00%> (+0.02%) ⬆️
e2e-api 46.18% <ø> (-0.13%) ⬇️
unit 70.05% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
apps/meteor/client/views/room/MessageList/hooks/useKeepAtBottom.ts (1)

39-41: ⚡ Quick win

Remove implementation comments and commented-out code from the hook callback.

This block leaves workaround comments and disabled style mutations in runtime code; move that context to commit/PR notes and keep implementation code-only. As per coding guidelines, **/*.{ts,tsx,js} should “Avoid code comments in the implementation”.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/meteor/client/views/room/MessageList/hooks/useKeepAtBottom.ts` around
lines 39 - 41, In the useKeepAtBottom hook callback, remove the entire comment
block and the three commented-out lines that reference the height hack
workaround. Delete the comment "Workaround for height hack in useAutoGrow" and
the three disabled style mutations setting node.style.height to '0' and then to
scrollHeight. Keep only the active implementation code and move any workaround
context to commit messages or pull request notes instead of leaving it as
comments in the runtime code.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@apps/meteor/client/views/room/MessageList/hooks/useKeepAtBottom.ts`:
- Around line 39-41: In the useKeepAtBottom hook callback, remove the entire
comment block and the three commented-out lines that reference the height hack
workaround. Delete the comment "Workaround for height hack in useAutoGrow" and
the three disabled style mutations setting node.style.height to '0' and then to
scrollHeight. Keep only the active implementation code and move any workaround
context to commit messages or pull request notes instead of leaving it as
comments in the runtime code.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c5203cdf-e3a7-4f2f-bf2d-a1b8bbe11c7e

📥 Commits

Reviewing files that changed from the base of the PR and between 2b8907d and edc204b.

📒 Files selected for processing (2)
  • .changeset/famous-birds-join.md
  • apps/meteor/client/views/room/MessageList/hooks/useKeepAtBottom.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: Hacktron Security Check
  • GitHub Check: 🔎 Code Check / Code Lint
  • GitHub Check: 🔨 Test Unit / Unit Tests
  • GitHub Check: 🔎 Code Check / TypeScript
  • GitHub Check: 📦 Meteor Build (coverage)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • apps/meteor/client/views/room/MessageList/hooks/useKeepAtBottom.ts
🧠 Learnings (6)
📚 Learning: 2026-03-16T21:50:37.589Z
Learnt from: amitb0ra
Repo: RocketChat/Rocket.Chat PR: 39676
File: .changeset/migrate-users-register-openapi.md:3-3
Timestamp: 2026-03-16T21:50:37.589Z
Learning: For changes related to OpenAPI migrations in Rocket.Chat/OpenAPI, when removing endpoint types and validators from rocket.chat/rest-typings (e.g., UserRegisterParamsPOST, /v1/users.register) document this as a minor changeset (not breaking) per RocketChat/Rocket.Chat-Open-API#150 Rule 7. Note that the endpoint type is re-exposed via a module augmentation .d.ts in the consuming package (e.g., packages/web-ui-registration/src/users-register.d.ts). In reviews, ensure the changeset clearly states: this is a non-breaking change, the major version should not be bumped, and the changeset reflects a minor version bump. Do not treat this as a breaking change during OpenAPI migrations.

Applied to files:

  • .changeset/famous-birds-join.md
📚 Learning: 2026-02-10T16:32:42.586Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38528
File: apps/meteor/client/startup/roles.ts:14-14
Timestamp: 2026-02-10T16:32:42.586Z
Learning: In Rocket.Chat's Meteor client code, DDP streams use EJSON and Date fields arrive as Date objects; do not manually construct new Date() in stream handlers (for example, in sdk.stream()). Only REST API responses return plain JSON where dates are strings, so implement explicit conversion there if needed. Apply this guidance to all TypeScript files under apps/meteor/client to ensure consistent date handling in DDP streams and REST responses.

Applied to files:

  • apps/meteor/client/views/room/MessageList/hooks/useKeepAtBottom.ts
📚 Learning: 2026-05-11T20:30:35.265Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 40480
File: apps/meteor/client/meteor/startup/accounts.ts:59-61
Timestamp: 2026-05-11T20:30:35.265Z
Learning: In Rocket.Chat’s Meteor client code, when calling `dispatchToastMessage` with `{ type: 'error' }`, pass the raw caught error object as `message` without manual normalization. `dispatchToastMessage` is designed to accept `message: unknown` for error toasts, so avoid converting errors to strings (e.g., `String(error)`) or extracting `error.message` before passing them.

Applied to files:

  • apps/meteor/client/views/room/MessageList/hooks/useKeepAtBottom.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • apps/meteor/client/views/room/MessageList/hooks/useKeepAtBottom.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • apps/meteor/client/views/room/MessageList/hooks/useKeepAtBottom.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.

Applied to files:

  • apps/meteor/client/views/room/MessageList/hooks/useKeepAtBottom.ts
🔇 Additional comments (1)
.changeset/famous-birds-join.md (1)

1-5: LGTM!

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Re-trigger cubic

@MartinSchoeler MartinSchoeler added this to the 8.6.0 milestone Jun 19, 2026
@MartinSchoeler MartinSchoeler added the stat: QA assured Means it has been tested and approved by a company insider label Jun 19, 2026
@dionisio-bot dionisio-bot Bot added the stat: ready to merge PR tested and approved waiting for merge label Jun 19, 2026
@dionisio-bot dionisio-bot Bot added this pull request to the merge queue Jun 19, 2026
Any commits made after this event will not be merged.
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 19, 2026
@juliajforesti juliajforesti added this pull request to the merge queue Jun 19, 2026
Any commits made after this event will not be merged.
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 19, 2026
@MartinSchoeler MartinSchoeler added stat: ready to merge PR tested and approved waiting for merge and removed stat: ready to merge PR tested and approved waiting for merge labels Jun 19, 2026
@dionisio-bot dionisio-bot Bot added this pull request to the merge queue Jun 19, 2026
Any commits made after this event will not be merged.
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 20, 2026
@alfredodelfabro alfredodelfabro removed this from the 8.6.0 milestone Jun 20, 2026
@dionisio-bot dionisio-bot Bot removed the stat: ready to merge PR tested and approved waiting for merge label Jun 20, 2026
@alfredodelfabro alfredodelfabro added this to the 8.6.0 milestone Jun 20, 2026
@dionisio-bot dionisio-bot Bot added the stat: ready to merge PR tested and approved waiting for merge label Jun 20, 2026
@dionisio-bot dionisio-bot Bot added this pull request to the merge queue Jun 20, 2026
Any commits made after this event will not be merged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge type: bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants