useChannelDetailsActionItems
A hook that builds the channel action rows (mute, leave, delete, block, etc.) rendered by the actions section of ChannelDetails. It wraps the shared useChannelActionItems for the channel resolved from the ChannelDetailsContext, and augments the dismissing actions (leave, deleteChannel, block) so they invoke onChannelDismiss once the action succeeds.
Best Practices
- Use it inside a
ChannelDetailsContextProvider, since it resolves the channel from that context. - Provide
onChannelDismissto navigate away once the channel is no longer available to the current user (leave, delete, or block). - Customize the action list through
getChannelActionItems(filter, reorder, replace, or add items) instead of rebuilding the section. - Keep your
getChannelActionItemsreference stable (memoize it) to avoid unnecessary recomputation. - Identify actions by their
idrather than by index.
Parameters
The hook accepts a single options object.
| Parameter | Description | Type |
|---|---|---|
getChannelActionItems | Customizes the list of action items. Receives the default items and returns the final list to render. | GetChannelActionItems |
onChannelDismiss | Fired after a dismissing action (leave, delete, or block) succeeds and the channel is no longer available. | () => void |
Return type
Returns an array of ChannelActionItem ready to render in the actions section.
| Type |
|---|
ChannelActionItem[] |