feat: show sync button on section/subsections [FC-0097] (#2324)
- Adds the sync button on section/subsection cards
This commit is contained in:
@@ -19,7 +19,7 @@ import { useQueryClient } from '@tanstack/react-query';
|
||||
import { Loop } from '@openedx/paragon/icons';
|
||||
import messages from './messages';
|
||||
import previewChangesMessages from '../course-unit/preview-changes/messages';
|
||||
import { courseLibrariesQueryKeys, useEntityLinks } from './data/apiHooks';
|
||||
import { invalidateLinksQuery, useEntityLinks } from './data/apiHooks';
|
||||
import {
|
||||
SearchContextProvider, SearchKeywordsField, useSearchContext, BlockTypeLabel, Highlight, SearchSortWidget,
|
||||
} from '../search-manager';
|
||||
@@ -189,7 +189,7 @@ const ItemReviewList = ({
|
||||
|
||||
const reloadLinks = useCallback((usageKey: string) => {
|
||||
const courseKey = outOfSyncItemsByKey[usageKey].downstreamContextKey;
|
||||
queryClient.invalidateQueries({ queryKey: courseLibrariesQueryKeys.courseLibraries(courseKey) });
|
||||
invalidateLinksQuery(queryClient, courseKey);
|
||||
}, [outOfSyncItemsByKey]);
|
||||
|
||||
const postChange = (accept: boolean) => {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';
|
||||
|
||||
const getApiBaseUrl = () => getConfig().STUDIO_BASE_URL;
|
||||
|
||||
export const getEntityLinksByDownstreamContextUrl = () => `${getApiBaseUrl()}/api/contentstore/v2/downstreams-all/`;
|
||||
export const getEntityLinksByDownstreamContextUrl = () => `${getApiBaseUrl()}/api/contentstore/v2/downstreams/`;
|
||||
export const getEntityLinksSummaryByDownstreamContextUrl = (downstreamContextKey: string) => `${getApiBaseUrl()}/api/contentstore/v2/downstreams/${downstreamContextKey}/summary`;
|
||||
|
||||
export interface PaginatedData<T> {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import {
|
||||
type QueryClient,
|
||||
useQuery,
|
||||
} from '@tanstack/react-query';
|
||||
import { getEntityLinksSummaryByDownstreamContext, getEntityLinks } from './api';
|
||||
@@ -70,3 +71,12 @@ export const useEntityLinksSummaryByDownstreamContext = (courseId?: string) => (
|
||||
enabled: courseId !== undefined,
|
||||
})
|
||||
);
|
||||
|
||||
/**
|
||||
* Ivalidates the downstream links query for a course
|
||||
*/
|
||||
export const invalidateLinksQuery = (queryClient: QueryClient, courseId: string) => {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: courseLibrariesQueryKeys.courseLibraries(courseId),
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user