fix: Resolve console warnings for rtl DOM attribute and untracked MobX read (#12284)

- Use transient `$rtl` prop on Meta styled component so it isn't forwarded to the DOM
- Wrap ActionButton in observer so action visibility checks read MobX computed values inside a reactive context

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Tom Moor
2026-05-06 20:48:13 -04:00
committed by GitHub
parent 9ddb57f1d3
commit 4387f3ced7
3 changed files with 7 additions and 5 deletions
+2 -1
View File
@@ -1,4 +1,5 @@
/* oxlint-disable react/prop-types */
import { observer } from "mobx-react";
import * as React from "react";
import type { Props as TooltipProps } from "~/components/Tooltip";
import Tooltip from "~/components/Tooltip";
@@ -85,4 +86,4 @@ const ActionButton = React.forwardRef<HTMLButtonElement, Props>(
}
);
export default ActionButton;
export default observer(ActionButton);
@@ -28,7 +28,7 @@ type Props = {
rtl?: boolean;
};
function TitleDocumentMeta({ to, document, revision, ...rest }: Props) {
function TitleDocumentMeta({ to, document, revision, rtl, ...rest }: Props) {
const { views, comments, ui } = useStores();
const { t } = useTranslation();
const sidebarContext = useLocationSidebarContext();
@@ -50,6 +50,7 @@ function TitleDocumentMeta({ to, document, revision, ...rest }: Props) {
revision={revision}
to={to}
replace
$rtl={rtl}
{...rest}
>
{commentingEnabled && can.comment && (
@@ -113,8 +114,8 @@ const InsightsButton = styled(NudeButton)`
}
`;
export const Meta = styled(DocumentMeta)<{ rtl?: boolean }>`
justify-content: ${(props) => (props.rtl ? "flex-end" : "flex-start")};
export const Meta = styled(DocumentMeta)<{ $rtl?: boolean }>`
justify-content: ${(props) => (props.$rtl ? "flex-end" : "flex-start")};
margin: -12px 0 2em 0;
font-size: 14px;
position: relative;
@@ -92,7 +92,7 @@ function RevisionViewer(props: Props, ref: React.Ref<TEditor>) {
document={document}
revision={revision}
to={documentPath(document)}
rtl={revision.rtl}
$rtl={revision.rtl}
/>
<Editor
key={compareToRevisionId}