fix(dashboard): propagate dark mode to code blocks inside list items#7667
Merged
Soulter merged 1 commit intoAstrBotDevs:masterfrom Apr 19, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- Using
props.isDark || injectedIsDark?.value || falsemeans an explicitly passedfalsewill be ignored if an injected dark value istrue; consider distinguishing betweenundefinedandfalse(e.g., with??or a different default) so an explicitfalsecan override the injected value. - The
inject<Ref<boolean>>("isDark", undefined)assumes the provided value is always aRef; if there’s any chance it might be a plain boolean, you may want to support both shapes (e.g., by checking for a.valueproperty before accessing it).
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Using `props.isDark || injectedIsDark?.value || false` means an explicitly passed `false` will be ignored if an injected dark value is `true`; consider distinguishing between `undefined` and `false` (e.g., with `??` or a different default) so an explicit `false` can override the injected value.
- The `inject<Ref<boolean>>("isDark", undefined)` assumes the provided value is always a `Ref`; if there’s any chance it might be a plain boolean, you may want to support both shapes (e.g., by checking for a `.value` property before accessing it).
## Individual Comments
### Comment 1
<location path="dashboard/src/components/shared/ThemeAwareMarkdownCodeBlock.vue" line_range="35-43" />
<code_context>
);
+const injectedIsDark = inject<Ref<boolean>>("isDark", undefined);
+const effectiveIsDark = computed(() => props.isDark || injectedIsDark?.value || false);
+
const attrs = useAttrs();
const forwardedBindings = computed(() => ({
...attrs,
...props,
+ isDark: effectiveIsDark.value,
}));
-const themeRenderKey = computed(() => (props.isDark ? "dark" : "light"));
+const themeRenderKey = computed(() => (effectiveIsDark.value ? "dark" : "light"));
</script>
</code_context>
<issue_to_address>
**issue (bug_risk):** Using `||` means an explicitly passed `isDark={false}` can no longer override an injected `true` value.
With the new `props.isDark || injectedIsDark?.value || false` logic, an injected `true` will override an explicit `isDark={false}` (`false || true` → `true`), changing the previous behavior where the prop alone controlled the theme. If the prop is meant to take precedence even when `false`, consider a tri-state/nullish approach (e.g. allow `null` as “unset” and use `computed(() => props.isDark ?? injectedIsDark?.value ?? false)`) so you keep the old semantics while still supporting an injected default.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the ThemeAwareMarkdownCodeBlock component to support theme injection. It introduces an effectiveIsDark computed property that resolves the theme state by checking the isDark prop and falling back to an injected isDark value from the parent context. The forwardedBindings and themeRenderKey have been updated to use this resolved value. I have no feedback to provide as no review comments were present.
c07a30f to
b6fa6c0
Compare
Soulter
approved these changes
Apr 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The upstream
markstream-vuelibrary'sListItemNodedoes not forward theisDarkprop to nestedNodeRenderer, causing code blocks inside list items to always render with a light background in dark mode.This fix makes
ThemeAwareMarkdownCodeBlockfall back to theisDarkvalue provided via Vue'sinject()(already set byMarkdownMessagePart.vue) when the prop is not correctly passed down by the upstream library.Fixes #7664
Modifications / 改动点
dashboard/src/components/shared/ThemeAwareMarkdownCodeBlock.vue: Addedinject("isDark")as a fallback when theisDarkprop is not propagated by the upstreammarkstream-vueListItemNode. The component now computes aneffectiveIsDarkthat usesprops.isDark || injectedIsDarkto ensure code blocks nested inside list items correctly receive the dark mode state.This is NOT a breaking change. / 这不是一个破坏性变更。
Screenshots or Test Results / 运行截图或测试结果
Before: In dark mode, code blocks at the top level display correctly with a dark background, but code blocks nested inside list items (

<li>) render with a white background (bg-white,background-color: #ffffff).After: All code blocks, including those nested inside list items, correctly display with a dark background (
bg-gray-900,background-color: #121212) in dark mode.Checklist / 检查清单
😊 If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
/ 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。
👀 My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
/ 我的更改经过了良好的测试,并已在上方提供了"验证步骤"和"运行截图"。
🤓 I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in
requirements.txtandpyproject.toml./ 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到
requirements.txt和pyproject.toml文件相应位置。😮 My changes do not introduce malicious code.
/ 我的更改没有引入恶意代码。
Summary by Sourcery
Bug Fixes: