Skip to content

Commit

Permalink
web: fix "show more" button (mitmproxy#6958)
Browse files Browse the repository at this point in the history
  • Loading branch information
Prinzhorn authored Jun 25, 2024
1 parent 7f7cb28 commit 27f9902
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions web/src/js/components/FlowView/Messages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function Messages({ flow, messages_meta }: MessagesPropTypes) {
const contentView = useAppSelector(
(state) => state.ui.flow.contentViewFor[flow.id + "messages"] || "Auto",
);
let [maxLines, setMaxLines] = useState<number>(
const [maxLines, setMaxLines] = useState<number>(
useAppSelector((state) => state.options.content_view_lines_cutoff),
);
const showMore = useCallback(
Expand Down Expand Up @@ -48,6 +48,8 @@ export default function Messages({ flow, messages_meta }: MessagesPropTypes) {
}
}, [content]) || [];

let remainingLines = maxLines;

return (
<div className="contentview">
<div className="controls">
Expand All @@ -73,12 +75,12 @@ export default function Messages({ flow, messages_meta }: MessagesPropTypes) {
</small>
<LineRenderer
lines={d.lines}
maxLines={maxLines}
maxLines={remainingLines}
showMore={showMore}
/>
</div>
);
maxLines -= d.lines.length;
remainingLines -= d.lines.length;
return renderer;
})}
</div>
Expand Down

0 comments on commit 27f9902

Please sign in to comment.