mattermost/webapp
Mattermost Build 13921e3a8a
Some checks failed
Server CI / Compute Go Version (push) Has been cancelled
Web App CI / check-lint (push) Has been cancelled
Web App CI / check-i18n (push) Has been cancelled
Web App CI / check-types (push) Has been cancelled
Web App CI / test (push) Has been cancelled
Web App CI / build (push) Has been cancelled
Server CI / Check mocks (push) Has been cancelled
Server CI / Check go mod tidy (push) Has been cancelled
Server CI / check-style (push) Has been cancelled
Server CI / Check serialization methods for hot structs (push) Has been cancelled
Server CI / Vet API (push) Has been cancelled
Server CI / Check migration files (push) Has been cancelled
Server CI / Generate email templates (push) Has been cancelled
Server CI / Check store layers (push) Has been cancelled
Server CI / Check mmctl docs (push) Has been cancelled
Server CI / Postgres with binary parameters (push) Has been cancelled
Server CI / Postgres (push) Has been cancelled
Server CI / Postgres (FIPS) (push) Has been cancelled
Server CI / Generate Test Coverage (push) Has been cancelled
Server CI / Run mmctl tests (push) Has been cancelled
Server CI / Run mmctl tests (FIPS) (push) Has been cancelled
Server CI / Build mattermost server app (push) Has been cancelled
MM-66659/MM-66832 Remove caretPosition state from AdvancedTextEditor (#34643) (#34721)
* Mock react-virtualized-auto-sizer in all unit tests to ensure contents are mounted

Without mocking that, anything inside of an `AutoSizer` wouldn't be rendered
at all, leading to weird behaviour like the emoji picker being empty in tests.

* Fix EmojiPickerCategoryRow not having a defaultMessage

This caused any unit tests involving the emoji picker to error unless you
also provided an intlMessages object which is hard to do due to how Jest's
`moduleNameMapper` option is configured currently.

* Fixed incorrect usage of useCallback in EmojiPickerItem

The way this was previously written, we weren't specifying dependencies
properly for those callbacks which lead to some actual performance issues
because of how heavy the emoji picker is, and it also lead to issues where
click handlers would have to be triggered multiple times in unit tests
for some reason.

* MM-66659 Stop using caretPosition in useEditorEmojiPicker

This bug seems to be caused by a race condition between React and Chrome which
only occurs on Windows and only now that we've upgraded to React 18. That race
condition occurs with how we map the selection range in the post textbox to
its `caretPosition` state. That state has always been pretty janky, so I've
decided to remove it.

This also has some other benefits like improving UX by using `execCommand`
which preserves the undo/redo stack when using the emoji picker and simplifying
the code because we no longer have to manually mess with the cursor position.
Also, while I was in there, I fixed some minor weirdness around how whitespace
is handled when adding those emojis.

* MM-66659 Stop using caretPosition in useKeyHandler

* MM-66659 Stop using caretPosition for prefill message

* MM-66659 Remove remaining traces of caretPosition in AdvancedTextEditor

* Fix exclusive test

* Fix "Fixed incorrect usage of useCallback in EmojiPickerItem"

* Fixed incorrect usage of FixedSizeList in emoji picker

This is the actual fix to the issue I thought I fixed previously by changing
how `useCallback` was called in EmojiPickerItem.

It turns out the actual issue is that we were passing a new function as the
child of FixedSizeList on every render cycle which caused it to re-render all
of the rows which somehow also assigned them new DOM Nodes as well. The
EmojiPicker re-renders whenever we mouse over an emoji, so it would re-render
the FixedSizeList and all of its children frequently when mousing over things.

Apart from causing performance issues, that also seems to cause RTL to fail to
click on an emoji the first time you call `userAgent.click` because the first
call would move the mouse which would trigger a re-render, and that would
seemingly cause RTL to forget what to click on.

To fix that, I used a new React context to pass the extra props to the
EmojiPickerCategoryOrEmojiRow. I could've also done that by adding them to the
FixedSizeList's `itemData` prop, but that already contains a lot of heavy data,
and I didn't want to add to that.

* Revert changes to postMessageOnKeyPress

* Run Prettier in playwright folder

* Added docs to new Playwright test

* Address feedback

(cherry picked from commit 5341b91566)

Co-authored-by: Harrison Healey <harrisonmhealey@gmail.com>
2025-12-12 11:10:00 +02:00
..
channels MM-66659/MM-66832 Remove caretPosition state from AdvancedTextEditor (#34643) (#34721) 2025-12-12 11:10:00 +02:00
patches MM-45255 Update web app to React 18 (#33858) 2025-10-07 11:11:12 -04:00
platform MM-66286 Copy Redux type extensions to mattermost-redux (#34348) (#34365) 2025-10-31 18:55:01 +00:00
scripts MM-64781 Update internal web app dependency versions and add script for future version updates (#33567) 2025-08-13 10:37:29 -04:00
.gitignore [MM-63582] Recent Mentions Not Properly Handling Hyphenated Custom Keywords (#30578) 2025-04-09 10:38:25 +00:00
.npmrc Disable legacy-peer-deps and manually override mismatched dependencies (#27677) 2024-07-18 15:36:02 -04:00
config.mk Mono repo -> Master (#22553) 2023-03-22 17:22:27 -04:00
Makefile fix(webapp/Makefile): Drop quotes around appended cppflags (#27374) 2024-06-18 15:56:45 -04:00
package-lock.json Update web app package versions to 11.1.0 (11.0 branch) (#34339) 2025-10-30 11:22:50 -04:00
package.json MM-45255 Update web app to React 18 (#33858) 2025-10-07 11:11:12 -04:00
README.md Prevent boards product from being included automatically (#23539) 2023-06-12 18:51:43 +02:00

Mattermost Web App

This folder contains the client code for the Mattermost web app. It's broken up into multiple packages each of which either contains an area of the app (such as playbooks) or shared logic used across other packages (such as the packages located in the platform directory). For anyone who's used to working in the mattermost/mattermost-webapp repo, most of that is now located in channels.

npm Workspaces

To interact with a workspace using npm, such as to add a dependency or run a script, use the --workspace (or --workspaces) flag. This can be done when using built-in npm commands such as npm add or when running scripts. Those commands should be run from this directory.

# Add a dependency to a single package
npm add react --workspace=playbooks

# Build multiple packages
npm run build --workspace=platform/client --workspace=platform/components

# Test all workspaces
npm test --workspaces

# Clean all workspaces that have a clean script defined
npm run clean --workspaces --if-present

To install dependencies for a workspace, simply run npm install from this folder as you would do normally. Most packages' dependencies will be included in the root node_modules, and all packages' dependencies will appear in the package-lock.json. A node_modules will only be created inside a package if one of its dependencies conflicts with that of another package.