Skip to content

Conversation

@MartinCupela
Copy link
Contributor

🎯 Goal

When link previews generation client-side was enabled, the failed upload attachments were also included in the sent message payload.

arnautov-anton and others added 4 commits May 8, 2025 10:19
### 🎯 Goal

Current `Channel.dragAndDropWindow` and
`Channel.optionalMessageInputProps` architecture which used to allow
drag&drop file upload by dropping files onto the message list (channel)
component suffers from a few pain points:
- duplicate `MessageInputContextProvider` initialization, see
[here](https://github.com/GetStream/stream-chat-react/blob/5fa6b0fc239a7d48032ae4c3d34e29969c52bd0c/src/components/Channel/Channel.tsx#L1479-L1484),
[here](https://github.com/GetStream/stream-chat-react/blob/5fa6b0fc239a7d48032ae4c3d34e29969c52bd0c/src/components/MessageInput/MessageInput.tsx#L137-L159)
and
[here](https://github.com/GetStream/stream-chat-react/blob/5fa6b0fc239a7d48032ae4c3d34e29969c52bd0c/src/components/MessageInput/DropzoneProvider.tsx#L47-L67)
([related
issue](https://getstream.slack.com/archives/C02R5UCGN6N/p1740392263047589))
- broken styling ([v2 vendor
folder](https://github.com/GetStream/stream-chat-css/tree/v5.8.0/src/v2/styles/vendor)
is missing [react-file-utils
styling](https://github.com/GetStream/stream-chat-css/blob/v5.8.0/src/vendor/react-file-utils.scss))

New solution allows dragging and uploading files both in "channel" and
in thread individually - which was previously impossible. The new
solution also reuses drag and drop styling which is used by default in
`MessageInputFlat` component (some minor adjustments from integrators
are needed - such as setting relative positioning on required parents).

#### Old API:

```tsx
<Channel dragAndDropWindow>
  <Window>
    <ChannelHeader />
    <MessageList />
    <AIStateIndicator />
    <MessageInput focus />
  </Window>
  <Thread virtualized />
</Channel>
```

#### New API:

```tsx
<Channel>
  <WithDragAndDropUpload className='str-chat__main-panel'>
    <ChannelHeader/>
    <MessageList />
    <AIStateIndicator />
    <MessageInput focus />
  </WithDragAndDropUpload>
  <WithDragAndDropUpload>
    <Thread virtualized />
  </WithDragAndDropUpload>
</Channel>
```

### Deprecations

#### Public

- `Channel.dragAndDropWindow` prop (will remove in v13)
- `Channel.optionalMessageInputProps` prop (will remove in v13)

#### Private

- `DropzoneProvider`
- `DropzoneInner`
- `ImageDropzone`

Note: This is not a direct fix of the issue I mentioned above (Slack
link), I believe the proper fix is to move away from this messy
architecture (by removing deprecated components and options which we'll
do in v13 once this PR is merged).

THIS PR RELIES ON [CSS
CHANGES](GetStream/stream-chat-css#329)

### 🎨 UI Changes
Before:

![image](https://github.com/user-attachments/assets/0514c338-8d52-44d8-aecd-60bf86acdee2)
After:

![image](https://github.com/user-attachments/assets/3afd1468-d552-4180-9be6-b9ffbe503526)
### 🎯 Goal

Yesterday evening I reconsidered how the wrapper should work - this way
it's much more simpler and allows multiple `MessageInput` components to
work under one wrapper without any clashing.

Since the previous feature has not been released yet, we can change the
context API without any worry and thus `refactor`.
## [12.15.0](v12.14.0...v12.15.0) (2025-05-02)

### Features

* introduce WithDragAndDropUpload component ([#2688](#2688)) ([6b03abd](6b03abd))

### Chores

* **deps:** upgrade @stream-io/stream-chat-css to v5.8.1 ([#2689](#2689)) ([d0c32e3](d0c32e3))

### Refactors

* simplify WithDragAndDropUpload API ([#2691](#2691)) ([46c9add](46c9add))
@MartinCupela MartinCupela force-pushed the fix/send-message-with-uploaded-attachments-only branch from cf457d4 to 742f8cd Compare May 9, 2025 13:00
@codecov
Copy link

codecov bot commented May 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (release-v12@98af293). Learn more about missing BASE report.

Additional details and impacted files
@@              Coverage Diff               @@
##             release-v12    #2704   +/-   ##
==============================================
  Coverage               ?   81.01%           
==============================================
  Files                  ?      471           
  Lines                  ?     9986           
  Branches               ?     2357           
==============================================
  Hits                   ?     8090           
  Misses                 ?     1773           
  Partials               ?      123           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 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.

@MartinCupela MartinCupela merged commit 8a66f6a into release-v12 May 9, 2025
5 checks passed
@MartinCupela MartinCupela deleted the fix/send-message-with-uploaded-attachments-only branch May 9, 2025 13:15
github-actions bot pushed a commit that referenced this pull request May 9, 2025
## [12.15.1](v12.15.0...v12.15.1) (2025-05-09)

### Bug Fixes

* send messages with successfully uploaded attachments only ([#2704](#2704)) ([8a66f6a](8a66f6a))
@stream-ci-bot
Copy link

🎉 This PR is included in version 12.15.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants