feat(embedded-sdk): Add resolvePermalinkUrl callback for custom permalink URLs (#36924)

This commit is contained in:
Michael S. Molina
2026-01-09 17:02:38 -03:00
committed by GitHub
parent 1e8d648f47
commit 53dddf4db2
9 changed files with 201 additions and 23 deletions

View File

@@ -204,8 +204,13 @@ export const useExploreAdditionalActionsMenu = (
const shareByEmail = useCallback(async () => {
try {
const subject = t('Superset Chart');
const url = await getChartPermalink(latestQueryFormData);
const body = encodeURIComponent(t('%s%s', 'Check out this chart: ', url));
const result = await getChartPermalink(latestQueryFormData);
if (!result?.url) {
throw new Error('Failed to generate permalink');
}
const body = encodeURIComponent(
t('%s%s', 'Check out this chart: ', result.url),
);
window.location.href = `mailto:?Subject=${subject}%20&Body=${body}`;
} catch (error) {
addDangerToast(t('Sorry, something went wrong. Try again later.'));
@@ -315,7 +320,13 @@ export const useExploreAdditionalActionsMenu = (
if (!latestQueryFormData) {
throw new Error();
}
await copyTextToClipboard(() => getChartPermalink(latestQueryFormData));
await copyTextToClipboard(async () => {
const result = await getChartPermalink(latestQueryFormData);
if (!result?.url) {
throw new Error('Failed to generate permalink');
}
return result.url;
});
addSuccessToast(t('Copied to clipboard!'));
} catch (error) {
addDangerToast(t('Sorry, something went wrong. Try again later.'));