Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

Commit 9007928

Browse files
committed
fix(context): fix useChannelLink error
1 parent 1cd68b9 commit 9007928

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

‎packages/console-utils/xconsole-context/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@alicloud/xconsole-context",
3-
"version": "2.5.0",
3+
"version": "2.5.1",
44
"main": "lib/index.js",
55
"module": "es/index.js",
66
"types": "lib/index.d.ts",

‎packages/console-utils/xconsole-context/src/rc/ChannelLink.tsx

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import React from 'react';
2-
import { ConsoleContext } from '../context/Context';
1+
import React, { useContext } from 'react';
32
import Link from '@alicloud/xconsole-rc-base-link';
43
import '@alicloud/xconsole-rc-base-link/dist/index.css';
54

5+
import { ConsoleContext } from '../context/Context';
6+
67
export interface IChannelLinkProps {
78
/**
89
*
@@ -58,13 +59,7 @@ export interface IChannelLinkProps {
5859
}
5960

6061
export const useChannelLink = (linkId: string, linkParams: Record<string, any>) => {
61-
if (typeof linkId === 'undefined') {
62-
throw new Error(
63-
'[ChannelLink] linkId is required',
64-
);
65-
}
66-
67-
const { consoleConfig } = React.useContext(ConsoleContext);
62+
const { consoleConfig } = useContext(ConsoleContext);
6863

6964
return consoleConfig.getChannelLink(linkId, linkParams);
7065
};

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /