PinDMs: ErrorBoundary renderChannel

This commit is contained in:
Nuckyz 2024-05-12 20:58:26 -03:00
parent fd7dafb153
commit 902b6bcdf2
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9

View file

@ -320,9 +320,10 @@ export default definePlugin({
</svg> </svg>
</h2> </h2>
); );
}), }, { noop: true }),
renderChannel(sectionIndex: number, index: number, ChannelComponent: React.ComponentType<ChannelComponentProps>) { renderChannel(sectionIndex: number, index: number, ChannelComponent: React.ComponentType<ChannelComponentProps>) {
return ErrorBoundary.wrap(() => {
const { channel, category } = this.getChannel(sectionIndex, index, this.instance.props.channels); const { channel, category } = this.getChannel(sectionIndex, index, this.instance.props.channels);
if (!channel || !category) return null; if (!channel || !category) return null;
@ -336,9 +337,9 @@ export default definePlugin({
{channel.id} {channel.id}
</ChannelComponent> </ChannelComponent>
); );
}, { noop: true });
}, },
getChannel(sectionIndex: number, index: number, channels: Record<string, Channel>) { getChannel(sectionIndex: number, index: number, channels: Record<string, Channel>) {
const category = categories[sectionIndex - 1]; const category = categories[sectionIndex - 1];
if (!category) return { channel: null, category: null }; if (!category) return { channel: null, category: null };