Skip to content

feat(events-v2): Page loader improvements #13645

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

Merged
merged 2 commits into from
Jun 11, 2019
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 @@ -43,7 +43,6 @@ const LoadingMask = styled('div')`
background-color: ${p => p.theme.white};
width: 100%;
height: 100%;
min-height: 240px;
opacity: ${p => (p.isReloading ? '0.6' : '1')};
`;

Expand Down
17 changes: 12 additions & 5 deletions src/sentry/static/sentry/app/views/organizationEventsV2/table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import space from 'app/styles/space';

import {SPECIAL_FIELDS} from './data';
import {QueryLink} from './styles';
import {getCurrentView} from './utils';

export default class Table extends React.Component {
static propTypes = {
Expand Down Expand Up @@ -56,11 +57,13 @@ export default class Table extends React.Component {
}

render() {
const {isLoading, view, data} = this.props;
const {isLoading, view, data, location} = this.props;
const {fields} = view.data;

// If previous state was empty, don't show the reloading state
const isReloading = !!(data && data.length) && isLoading;
// If previous state was empty or we are switching tabs, don't show the
// reloading state
const isSwitchingTab = getCurrentView(location.query.view) !== view.id;
const isReloading = !!(data && data.length) && isLoading && !isSwitchingTab;

return (
<Panel>
Expand All @@ -73,11 +76,11 @@ export default class Table extends React.Component {
</HeaderItem>
))}
</TableHeader>
<PanelBody>
<StyledPanelBody isLoading={isLoading || isReloading}>
<LoadingContainer isLoading={isLoading} isReloading={isReloading}>
{this.renderBody()}
</LoadingContainer>
</PanelBody>
</StyledPanelBody>
</Panel>
);
}
Expand Down Expand Up @@ -109,3 +112,7 @@ const Cell = styled('div')`
align-items: center;
overflow: hidden;
`;

const StyledPanelBody = styled(({isLoading, ...props}) => <PanelBody {...props} />)`
${p => p.isLoading && 'min-height: 240px;'};
`;