Skip to content

Commit

Permalink
refactor: allow open the problem modal when is a new component
Browse files Browse the repository at this point in the history
  • Loading branch information
dcoa committed Dec 17, 2024
1 parent 09fd30f commit 7b0b9c8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/editors/containers/ProblemEditor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,13 @@ const ProblemEditor: React.FC<Props> = ({
};

export const mapStateToProps = (state) => ({
blockFinished: selectors.requests.isFinished(state, { requestKey: RequestKeys.fetchBlock }),
blockFinished: selectors.app.isCreateBlock(state)
|| selectors.requests.isFinished(state, { requestKey: RequestKeys.fetchBlock }),
blockFailed: selectors.requests.isFailed(state, { requestKey: RequestKeys.fetchBlock }),
problemType: selectors.problem.problemType(state),
blockValue: selectors.app.blockValue(state),
advancedSettingsFinished: selectors.requests.isFinished(state, { requestKey: RequestKeys.fetchAdvancedSettings }),
advancedSettingsFinished: selectors.app.isCreateBlock(state)
|| selectors.requests.isFinished(state, { requestKey: RequestKeys.fetchAdvancedSettings }),
});

export const mapDispatchToProps = {
Expand Down
3 changes: 2 additions & 1 deletion src/editors/data/redux/thunkActions/problem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export const getDataFromOlx = ({ rawOLX, rawSettings, defaultSettings }) => {
};

export const loadProblem = ({ rawOLX, rawSettings, defaultSettings }) => (dispatch) => {
console.debug(rawOLX);

Check warning on line 62 in src/editors/data/redux/thunkActions/problem.ts

View workflow job for this annotation

GitHub Actions / tests

Unexpected console statement
if (isBlankProblem({ rawOLX })) {
dispatch(actions.problem.setEnableTypeSelection(camelizeKeys(defaultSettings)));
} else {
Expand All @@ -84,7 +85,7 @@ export const fetchAdvancedSettings = ({ rawOLX, rawSettings }) => (dispatch) =>
};

export const initializeProblem = (blockValue) => (dispatch, getState) => {
const rawOLX = _.get(blockValue, 'data.data', {});
const rawOLX = _.get(blockValue, 'data.data', '');
const rawSettings = _.get(blockValue, 'data.metadata', {});
const learningContextId = selectors.app.learningContextId(getState());
if (isLibraryKey(learningContextId)) {
Expand Down

0 comments on commit 7b0b9c8

Please sign in to comment.