Skip to content

Commit

Permalink
fix: verify if legacy execution is non-null (#596)
Browse files Browse the repository at this point in the history
After #579 we convert old executions into new format, but it had two
issues that caused crash or unexpected behaviour:
- drafts that didn't have execution at all (executionStrategy was null)
  would cause a crash
- drafts with execution in legacy format would keep reverting to that
  legacy execution even though if it was changed later
  • Loading branch information
Sekhmet authored Aug 7, 2024
1 parent 8560847 commit ead1ebe
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions apps/ui/src/composables/useEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@ const processedProposals = Object.fromEntries(

// convert single treasury to multiple treasuries format
if ('execution' in processed && 'executionStrategy' in processed) {
processed.executions = {
[processed.executionStrategy.address]: processed.execution
};
processed.executions =
processed.executionStrategy && processed.execution
? {
[processed.executionStrategy.address]: processed.execution
}
: {};

delete processed.execution;
delete processed.executionStrategy;
}

return [k, v];
Expand Down

0 comments on commit ead1ebe

Please sign in to comment.