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

fix(dashboard): Only fetch CSS templates for dashboard header menu when in edit mode #27411

Merged
merged 3 commits into from
Mar 8, 2024
Merged
Changes from 1 commit
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 @@ -110,20 +110,22 @@
}

UNSAFE_componentWillMount() {
SupersetClient.get({ endpoint: '/csstemplateasyncmodelview/api/read' })
.then(({ json }) => {
const cssTemplates = json.result.map(row => ({
value: row.template_name,
css: row.css,
label: row.template_name,
}));
this.setState({ cssTemplates });
})
.catch(() => {
this.props.addDangerToast(
t('An error occurred while fetching available CSS templates'),
);
});
if (this.props.editMode) {
SupersetClient.get({ endpoint: '/csstemplateasyncmodelview/api/read' })
.then(({ json }) => {
const cssTemplates = json.result.map(row => ({
value: row.template_name,
css: row.css,
label: row.template_name,
}));
this.setState({ cssTemplates });

Check warning on line 121 in superset-frontend/src/dashboard/components/Header/HeaderActionsDropdown/index.jsx

View check run for this annotation

Codecov / codecov/patch

superset-frontend/src/dashboard/components/Header/HeaderActionsDropdown/index.jsx#L121

Added line #L121 was not covered by tests
})
.catch(() => {
this.props.addDangerToast(
t('An error occurred while fetching available CSS templates'),
);
});
}
}

UNSAFE_componentWillReceiveProps(nextProps) {
Expand Down
Loading