Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to merge duplicates as first goal. #990

Closed
johnthagen opened this issue Feb 5, 2021 · 2 comments · Fixed by #1004
Closed

Unable to merge duplicates as first goal. #990

johnthagen opened this issue Feb 5, 2021 · 2 comments · Fixed by #1004
Labels
bug Something isn't working duplicate This issue or pull request already exists goal: MergeDup

Comments

@johnthagen
Copy link
Collaborator

  1. Create a new project
  2. Add two new word entries
  3. Data Entry | Merge Duplicates
Unhandled Rejection (TypeError): Cannot read property 'goalType' of undefined
updateStepData
C:/Users/User/GitHub/TheCombine/src/components/GoalTimeline/GoalsActions.tsx:150
  147 | // Helper Funtions
  148 | 
  149 | export function updateStepData(goal: Goal): Goal {
> 150 |   switch (goal.goalType) {
  151 |     case GoalType.MergeDups: {
  152 |       const currentGoalData = goal.data as MergeDupData;
  153 |       goal.steps[goal.currentStep] = {
View compiled
updateStep
C:/Users/User/GitHub/TheCombine/src/components/GoalTimeline/GoalsActions.tsx:186
  183 |   goalHistory: Goal[]
  184 | ): Promise<void> {
  185 |   const goalIndex = goalHistory.findIndex((g) => g.hash === goal.hash);
> 186 |   const updatedGoal = updateStepData(goal);
  187 |   dispatch(updateGoal(updatedGoal));
  188 |   await addStepToGoal(goalHistory[goalIndex], goalIndex);
  189 | }
View compiled
(anonymous function)
C:/Users/User/GitHub/TheCombine/src/components/GoalTimeline/GoalsActions.tsx:133
  130 | let goal = goalHistory[goalHistory.length - 1];
  131 | 
  132 | // Push the current step into the history state and load the data.
> 133 | await updateStep(dispatch, goal, goalHistory).then(() => {
      | ^  134 |   goalHistory = getState().goalsState.historyState.history;
  135 |   goal = goalHistory[goalHistory.length - 1];
  136 |   if (goal.currentStep < goal.numSteps) {
View compiled
▶ 2 stack frames were collapsed.
(anonymous function)
C:/Users/User/GitHub/TheCombine/src/components/GoalTimeline/GoalsActions.tsx:107
  104 | switch (goal.goalType) {
  105 |   case GoalType.MergeDups:
  106 |     goal = await loadMergeDupsData(goal);
> 107 |     await dispatch(asyncRefreshWords());
      | ^  108 |     break;
  109 | 
  110 |   default:
View compiled
async
C:/Users/User/GitHub/TheCombine/src/components/GoalTimeline/GoalsActions.tsx:94
  91 | return async (dispatch: StoreStateDispatch) => {
  92 |   const userEditId = getUserEditId();
  93 |   if (userEditId) {
> 94 |     goal = await dispatch(asyncLoadGoalData(goal));
     | ^  95 |     const goalIndex = await Backend.addGoalToUserEdit(userEditId, goal);
  96 |     dispatch(addGoalToHistory(goal));
  97 |     history.push(`${Path.Goals}/${goalIndex}`);
@johnthagen johnthagen added bug Something isn't working frontend goal: MergeDup labels Feb 5, 2021
@imnasnainaec imnasnainaec changed the title Unable to merge duplicates Unable to merge duplicates as first goal. Feb 5, 2021
@imnasnainaec
Copy link
Collaborator

Duplicate of #588

@imnasnainaec imnasnainaec marked this as a duplicate of #588 Feb 5, 2021
@imnasnainaec imnasnainaec added duplicate This issue or pull request already exists and removed frontend labels Feb 5, 2021
@johnthagen
Copy link
Collaborator Author

To work around this issue, perform a Review Entries goal first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists goal: MergeDup
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants