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

Improve RawVis fallback message when dataset is too big to display #1462

Merged
merged 1 commit into from
Aug 25, 2023
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
2 changes: 1 addition & 1 deletion packages/app/src/__tests__/CorePack.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ test('log raw dataset to console if too large', async () => {
const logSpy = mockConsoleMethod('log');
await renderApp('/entities/raw_large');

await expect(screen.findByText(/dataset is too big/)).resolves.toBeVisible();
await expect(screen.findByText(/Too big to display/)).resolves.toBeVisible();
expect(logSpy).toHaveBeenCalledWith(mockValues.raw_large);
});

Expand Down
17 changes: 17 additions & 0 deletions packages/lib/src/vis/raw/RawVis.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,21 @@

.fallback {
composes: fallback from global;
max-width: 26em;
line-height: 1.5;
}

.reason {
margin-top: 0;
margin-bottom: 0.75rem;
font-weight: 600;
}

.message {
margin-top: 0;
font-size: 0.875em;
}

.message > kbd {
font-weight: 600;
}
11 changes: 7 additions & 4 deletions packages/lib/src/vis/raw/RawVis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ function RawVis(props: Props) {
console.log(value); // eslint-disable-line no-console

return (
<p className={styles.fallback}>
The dataset is too big to be displayed and was logged to the console
instead.
</p>
<div className={styles.fallback}>
<p className={styles.reason}>Too big to display</p>
<p className={styles.message}>
Dataset logged to the browser's developer console instead. Press{' '}
<kbd>F12</kbd> to open the developer tools and access the console.
</p>
</div>
);
}

Expand Down