Skip to content

Commit

Permalink
fix(graphql): add defensive check on getTablesRequiringReplacement (#…
Browse files Browse the repository at this point in the history
…8528)

* fix(graphql): add defensive check on getTablesRequiringReplacement

* correct return statement
  • Loading branch information
sundersc authored Oct 22, 2021
1 parent 7c9bb7e commit 26efb7a
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,11 @@ export class GraphQLResourceManager {
getTablesBeingReplaced = () => {
const gqlDiff = getGQLDiff(this.backendApiProjectRoot, this.cloudBackendApiProjectRoot);
const [diffs, currentState] = [gqlDiff.diff, gqlDiff.current];
const getTablesRequiringReplacement = () =>
_.uniq(
const getTablesRequiringReplacement = () => {
if (!diffs) {
return [];
}
return _.uniq(
diffs
.filter(diff => diff.path.includes('KeySchema') || diff.path.includes('LocalSecondaryIndexes')) // filter diffs with changes that require replacement
.map(diff => ({
Expand All @@ -297,7 +300,7 @@ export class GraphQLResourceManager {
stackName: diff.path[1].split('.')[0] as string,
})),
) as { tableName: string; stackName: string }[];

}
const getAllTables = () =>
Object.entries(currentState.stacks)
.map(([name, template]) => ({
Expand Down

0 comments on commit 26efb7a

Please sign in to comment.