Skip to content
This repository has been archived by the owner on Feb 14, 2025. It is now read-only.

Commit

Permalink
feat: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rayzhou-bit committed Dec 19, 2023
1 parent 3a689a4 commit 0d51711
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 30 deletions.
18 changes: 0 additions & 18 deletions src/editors/__snapshots__/Editor.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@
exports[`Editor render presents error message if no relevant editor found and ref ready 1`] = `
<div
className="d-flex flex-column"
style={
Object {
"height": "100%",
"left": 0,
"position": "fixed",
"right": 0,
"top": 0,
}
}
>
<div
aria-label="fAkEBlock"
Expand All @@ -30,15 +21,6 @@ exports[`Editor render presents error message if no relevant editor found and re
exports[`Editor render snapshot: renders correct editor given blockType (html -> TextEditor) 1`] = `
<div
className="d-flex flex-column"
style={
Object {
"height": "100%",
"left": 0,
"position": "fixed",
"right": 0,
"top": 0,
}
}
>
<div
aria-label="html"
Expand Down
6 changes: 0 additions & 6 deletions src/editors/containers/LibraryContentEditor/data/api.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@ describe('library api', () => {
expect(get).toHaveBeenCalledWith(urls.v2Libraries({ studioEndpointUrl }));
});
});
describe('v2LibraryMetadata', () => {
it('should call get with urls.v2LibraryMetadata', () => {
apiMethods.fetchV2LibraryMetadata({ studioEndpointUrl, libraryId });
expect(get).toHaveBeenCalledWith(urls.v2LibraryMetadata({ studioEndpointUrl, libraryId }));
});
});
describe('v2LibraryContent', () => {
it('should call get with urls.v2LibraryContent', () => {
apiMethods.fetchV2LibraryContent({ studioEndpointUrl, libraryId });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const libraryPayload = createSelector(
shuffle = false;
count = -1;
}
count = count.toString();
count = count;
showReset = settings[selectedLibraryId].showReset;
candidateList = settings[selectedLibraryId].candidates;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ describe('Library Selectors', () => {
libraryVersion: testData.selectedLibraryVersion,
manual: true,
shuffle: false,
count: '-1',
count: -1,
showReset: testData.settings[selectedLibraryId].showReset,
candidates: [[blockType1, blockId1], [blockType2, blockId2]],
});
Expand All @@ -145,7 +145,7 @@ describe('Library Selectors', () => {
libraryVersion: testData.selectedLibraryVersion,
manual: false,
shuffle: true,
count: testData.settings[selectedLibraryId].count.toString(),
count: testData.settings[selectedLibraryId].count,
showReset: testData.settings[selectedLibraryId].showReset,
candidates: [[blockType1, blockId1], [blockType2, blockId2]],
});
Expand Down
3 changes: 2 additions & 1 deletion src/editors/containers/LibraryContentEditor/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { modes } from './constants';
import { actions } from '../../data/redux';
import * as requests from './data/requests';
import { RequestKeys } from '../../data/constants/requests';
import { isV1Library } from './utils';

export const useLibraryHook = ({
blockFailed,
Expand Down Expand Up @@ -99,7 +100,7 @@ export const useBlocksHook = ({

// fetch v2 library content
useEffect(() => {
if (selectedLibraryId) {
if (!isV1Library(selectedLibraryId)) {
dispatch(requests.fetchV2LibraryContent({
libraryId: selectedLibraryId,
onSuccess: (response) => {
Expand Down
2 changes: 1 addition & 1 deletion src/editors/data/services/cms/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export const apiMethods = {
max_count: content.count,
shuffle: content.shuffle,
source_library_id: content.libraryId,
source_library_version: content.libraryVersion.toString(),
source_library_version: content.libraryVersion,
},
};
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/editors/data/services/cms/api.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ describe('cms api', () => {
max_count: content.count,
shuffle: content.shuffle,
source_library_id: content.libraryId,
source_library_version: '1',
source_library_version: 1,
},
});
});
Expand Down

0 comments on commit 0d51711

Please sign in to comment.