Skip to content

Commit 17069e7

Browse files
committed
fix multiline deprecation display issue #3348
1 parent ffb6486 commit 17069e7

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

.changeset/fifty-numbers-draw.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'graphiql': patch
3+
'@graphiql/react': patch
4+
---
5+
6+
fix display of deprecation reason on field type docs

packages/graphiql-react/src/explorer/components/deprecation-reason.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,17 @@ type DeprecationReasonProps = {
77
* The deprecation reason as markdown string.
88
*/
99
children?: string | null;
10+
preview?: boolean;
1011
};
1112

1213
export function DeprecationReason(props: DeprecationReasonProps) {
1314
return props.children ? (
1415
<div className="graphiql-doc-explorer-deprecation">
1516
<div className="graphiql-doc-explorer-deprecation-label">Deprecated</div>
16-
<MarkdownContent type="deprecation" onlyShowFirstChild>
17+
<MarkdownContent
18+
type="deprecation"
19+
onlyShowFirstChild={props.preview ?? true}
20+
>
1721
{props.children}
1822
</MarkdownContent>
1923
</div>

packages/graphiql-react/src/explorer/components/field-documentation.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ export function FieldDocumentation(props: FieldDocumentationProps) {
2424
{props.field.description}
2525
</MarkdownContent>
2626
) : null}
27-
<DeprecationReason>{props.field.deprecationReason}</DeprecationReason>
27+
<DeprecationReason preview={false}>
28+
{props.field.deprecationReason}
29+
</DeprecationReason>
2830
<ExplorerSection title="Type">
2931
<TypeLink type={props.field.type} />
3032
</ExplorerSection>

packages/graphiql/resources/webpack.config.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const relPath = (...args) => path.resolve(__dirname, ...args);
1212
const rootPath = (...args) => relPath('../', ...args);
1313

1414
const resultConfig = ({ isDev = false }) => {
15-
const isHMR = Boolean(isDev && process.env.WEBPACK_DEV_SERVER);
15+
const isHMR = Boolean(isDev && process.env.WEBPACK_SERVE);
1616

1717
const config = {
1818
mode: isDev ? 'development' : 'production',
@@ -126,8 +126,8 @@ const resultConfig = ({ isDev = false }) => {
126126
}
127127
return config;
128128
};
129-
130-
module.exports = [
131-
resultConfig({ isDev: true }),
132-
resultConfig({ isDev: false }),
133-
];
129+
const configs = [resultConfig({ isDev: true })];
130+
if (!process.env.WEBPACK_SERVE) {
131+
configs.push(resultConfig({ isDev: false }));
132+
}
133+
module.exports = configs;

0 commit comments

Comments
 (0)