msyavuz opened a new pull request, #41998:
URL: https://github.com/apache/superset/pull/41998

   ### SUMMARY
   
   On workspaces with tens of thousands of Slack channels, the Alerts & Reports 
**Slack recipient picker** freezes the browser and the backend returns `504`. 
The SlackV2 picker eagerly pulled **every** channel (`conversations.list` is 
paginated and has no search API), so it hit Slack rate limits during 
enumeration and rendered the entire list at once. The UI's 
`searchString`/`exactMatch` params were also silently ignored (the endpoint 
reads `search_string`/`exact_match`), so search never reached the server.
   
   **Backend** — `/report/slack_channels/` now accepts `page`/`page_size` and 
returns the requested page plus the full `count`, so the browser never receives 
the whole list. `get_channels_with_search` is unchanged (caching and 
`execute.py` unaffected); slicing happens at the API layer over the warm-cached 
filtered set.
   
   **Frontend** — the SlackV2 picker moves from an eager `Select` to 
`AsyncSelect`: debounced server-side search, one page at a time (can't freeze), 
plus `allowNewOptions` so a channel ID can be **pasted directly** and used 
immediately. This is the guaranteed unblock for huge workspaces — SlackV2 send 
passes channel-ID strings straight to `chat_postMessage`, no list membership 
required. Edit-mode IDs resolve to names via a bounded `exact_match` lookup.
   
   Large workspaces should schedule the existing `slack.cache_channels` Celery 
task to keep the cache warm (documented in `config.py`).
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A — behavioral fix; no static screenshot captures the freeze. Manual 
repro/verification steps below.
   
   ### TESTING INSTRUCTIONS
   
   Automated: `pytest tests/unit_tests/reports/api_test.py` (pagination + 
count) and `npm run test -- NotificationMethod` (lazy pagination + direct 
channel-ID entry).
   
   Manual (with `ALERT_REPORT_SLACK_V2` on and a Slack bot token configured):
   1. Create an Alert/Report → Notification Method → **Slack**.
   2. Type part of a channel name — results now load one page at a time via the 
server instead of pulling every channel.
   3. Paste a raw channel ID (e.g. `C0123456789`) — it is accepted directly 
without the full list loading, and a test send delivers to that channel.
   4. Edit an existing Slack report — saved channels render immediately (as 
IDs, enriched to names once resolved).
   5. For a large workspace, run the `slack.cache_channels` task once and 
confirm the dropdown browses quickly from the warm cache.
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [x] Required feature flags: `ALERT_REPORT_SLACK_V2` (existing; unchanged)
   - [x] Changes UI — Slack recipient picker is now an async, searchable select 
that accepts pasted channel IDs
   - [ ] Includes DB Migration
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   API change is additive/backwards-compatible: the endpoint gains optional 
`page`/`page_size` and a `count` field; the previously-ignored 
`search_string`/`exact_match` now take effect.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to