aminghadersohi commented on code in PR #38567:
URL: https://github.com/apache/superset/pull/38567#discussion_r2931759362
##########
superset-frontend/src/features/dashboards/DashboardCard.tsx:
##########
@@ -69,33 +64,11 @@ function DashboardCard({
const canEdit = hasPerm('can_write');
const canDelete = hasPerm('can_write');
const canExport = hasPerm('can_export');
- const [thumbnailUrl, setThumbnailUrl] = useState<string | null>(null);
- const [fetchingThumbnail, setFetchingThumbnail] = useState<boolean>(false);
-
- useEffect(() => {
- // fetch thumbnail only if it's not already fetched
- if (
- !fetchingThumbnail &&
- dashboard.id &&
- (thumbnailUrl === undefined || thumbnailUrl === null) &&
- isFeatureEnabled(FeatureFlag.Thumbnails)
- ) {
- // fetch thumbnail
- if (dashboard.thumbnail_url) {
- // set to empty string if null so that we don't
- // keep fetching the thumbnail
- setThumbnailUrl(dashboard.thumbnail_url || '');
- return;
- }
- setFetchingThumbnail(true);
- SupersetClient.get({
- endpoint: `/api/v1/dashboard/${dashboard.id}`,
- }).then(({ json = {} }) => {
- setThumbnailUrl(json.result?.thumbnail_url || '');
- setFetchingThumbnail(false);
- });
- }
- }, [dashboard, thumbnailUrl]);
+ const thumbnailUrl =
+ isFeatureEnabled(FeatureFlag.Thumbnails) && dashboard.id
+ ? dashboard.thumbnail_url ||
+
`/api/v1/dashboard/${dashboard.id}/thumbnail/${encodeURIComponent(dashboard.changed_on_utc
|| 'default')}/`
+ : '';
Review Comment:
Good catch. `DashboardList/index.tsx` fetches `changed_on` but not
`changed_on_utc`, so the cache-busting parameter would always resolve to
`'default'`. Fixed in 146b18b: added `changed_on` as secondary fallback and
typed it in the `Dashboard` interface.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]