Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit a8f141d

Browse files
committed
fix(plugins/plugin-client-common): fix for react errors in Markdown and StatusStripe
1. we were calling (transitively) a setState from a render() 2. missing key in StatusStripe
1 parent 8e6b581 commit a8f141d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

plugins/plugin-client-common/src/components/Client/StatusStripe/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export default class StatusStripe extends React.PureComponent<Props, State> {
9494
return msg.split(pat).reduce(
9595
(M, _) => {
9696
if (_ === '') {
97-
M.A.push(<strong>{bolds[M.idx++].replace(/\*\*/g, '')}</strong>)
97+
M.A.push(<strong key={M.A.length + 1}>{bolds[M.idx++].replace(/\*\*/g, '')}</strong>)
9898
} else {
9999
M.A.push(_)
100100
}

plugins/plugin-client-common/src/components/Content/Markdown/frontmatter.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,10 @@ export function kuiFrontmatter(opts: { tab: Tab }) {
158158
}
159159

160160
if (frontmatter.title && typeof frontmatter.title === 'string') {
161-
opts.tab.setTitle(frontmatter.title)
161+
// don't do this synchronously. react complains about
162+
// any transitive calls to setState() called from a
163+
// render() method
164+
setTimeout(() => opts.tab.setTitle(frontmatter.title))
162165
}
163166
} catch (err) {
164167
console.error('Error parsing Markdown yaml frontmatter', err)

0 commit comments

Comments
 (0)