Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[APM] Fix for library frames not collapsing #26827

Merged
merged 2 commits into from
Dec 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,52 @@ const LibraryFrameToggle = styled.div`
user-select: none;
`;

interface LibraryStackFrameProps {
codeLanguage?: string;
stackframe: Stackframe;
}

const LibraryStackFrame: React.SFC<LibraryStackFrameProps> = ({
codeLanguage,
stackframe
}) => {
return hasSourceLines(stackframe) ? (
<CodePreview
stackframe={stackframe}
isLibraryFrame
codeLanguage={codeLanguage}
/>
) : (
<FrameHeading stackframe={stackframe} isLibraryFrame />
);
};

interface Props {
visible?: boolean;
stackframes: Stackframe[];
codeLanguage?: string;
onClick: () => void;
}

export const LibraryFrames: React.SFC<Props> = ({
export const LibraryStackFrames: React.SFC<Props> = ({
visible,
stackframes,
codeLanguage,
onClick
}) => {
if (stackframes.length === 0) {
return null;
}

if (stackframes.length === 1) {
return (
<LibraryStackFrame
codeLanguage={codeLanguage}
stackframe={stackframes[0]}
/>
);
}

return (
<div>
<LibraryFrameToggle>
Expand All @@ -44,18 +77,13 @@ export const LibraryFrames: React.SFC<Props> = ({

<div>
{visible &&
stackframes.map((stackframe, i) =>
hasSourceLines(stackframe) ? (
<CodePreview
key={i}
stackframe={stackframe}
isLibraryFrame
codeLanguage={codeLanguage}
/>
) : (
<FrameHeading key={i} stackframe={stackframe} isLibraryFrame />
)
)}
stackframes.map((stackframe, i) => (
<LibraryStackFrame
key={i}
codeLanguage={codeLanguage}
stackframe={stackframe}
/>
))}
</div>
</div>
);
Expand Down
Loading