Skip to content

Commit 2859cfd

Browse files
authored
Release v1.40.3 (#971)
## Fixes - Remove deleted column keys when updating row - Dedupe multiple CC repeated emails
2 parents 1826dd7 + 373c08e commit 2859cfd

File tree

10 files changed

+44
-19
lines changed

10 files changed

+44
-19
lines changed

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/backend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,5 +106,5 @@
106106
"tsconfig-paths": "^4.2.0",
107107
"type-fest": "4.10.3"
108108
},
109-
"version": "1.40.2"
109+
"version": "1.40.3"
110110
}

packages/backend/src/apps/postman/__tests__/common/parameters.test.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,26 @@ describe('postman transactional email schema zod validation', () => {
134134
expect(result.data.body).toBe('hello<br>hihi')
135135
})
136136

137-
it('should validate multiple valid CC emails', () => {
137+
it('should validate and lowercase multiple valid CC emails', () => {
138138
validPayload.destinationEmailCc =
139139
140140
const result = transactionalEmailSchema.safeParse(validPayload)
141141
assert(result.success === true) // using assert here for type assertion
142142
expect(result.data.destinationEmailCc).toEqual([
143-
144-
145-
143+
144+
145+
146+
])
147+
})
148+
149+
it('should dedupe repeated multiple valid CC emails', () => {
150+
validPayload.destinationEmailCc =
151+
152+
const result = transactionalEmailSchema.safeParse(validPayload)
153+
assert(result.success === true) // using assert here for type assertion
154+
expect(result.data.destinationEmailCc).toEqual([
155+
156+
146157
])
147158
})
148159

packages/backend/src/apps/postman/common/parameters.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { parseS3Id } from '@/helpers/s3'
99
function recipientStringToArray(value: string) {
1010
const recipientArray = value
1111
.split(',')
12-
.map((e) => e.trim())
12+
.map((e) => e.trim().toLowerCase())
1313
.filter((e) => e?.length > 0)
1414
// dedupe the array
1515
return uniq(recipientArray)

packages/frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "frontend",
3-
"version": "1.40.2",
3+
"version": "1.40.3",
44
"scripts": {
55
"dev": "wait-on tcp:3000 && vite --host --force",
66
"build": "tsc && vite build --mode=${VITE_MODE:-prod}",

packages/frontend/src/components/SuggestionsWrapper/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export default function SuggestionsWrapper(props: SuggestionsWrapperProps) {
8282

8383
{/* Right Panel --> Data Selector */}
8484
<Box flexGrow={1} w="50%">
85-
<PanelHeader>{headers.left}</PanelHeader>
85+
<PanelHeader>{headers.right}</PanelHeader>
8686
<Divider borderColor="base.divider.medium" />
8787
{rightPanel}
8888
</Box>

packages/frontend/src/graphql/cache.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@ export const cacheConfig = {
1010
App: {
1111
keyFields: ['key'],
1212
},
13+
// prevent apollo client from complaining about cache data loss
14+
// for use when updating table (columns/names/etc)
15+
TableMetadata: {
16+
fields: {
17+
columns: {
18+
merge(_existing = [], incoming: any[]) {
19+
return incoming // Replace existing with incoming
20+
},
21+
},
22+
},
23+
},
1324
Mutation: {
1425
mutationType: true,
1526
fields: {

packages/frontend/src/pages/Tile/hooks/useUpdateRow.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ interface UpdateRowOutput {
2121
export function useUpdateRow(
2222
setData: Dispatch<SetStateAction<GenericRowData[]>>,
2323
) {
24-
const { tableId } = useTableContext()
24+
const { tableId, tableColumns } = useTableContext()
2525
const [rowsUpdating, setRowsUpdating] = useState<Record<string, boolean>>({})
2626

2727
const [updateRowMutation] = useMutation<UpdateRowOutput, UpdateRowInput>(
@@ -45,6 +45,12 @@ export function useUpdateRow(
4545
const updateRow = useCallback(
4646
async (updatedRow: GenericRowData) => {
4747
const { rowId, ...data } = updatedRow
48+
// delete keys from data that are not in the table (recently deleted columns)
49+
Object.keys(data).forEach((key) => {
50+
if (!tableColumns.some((column) => column.id === key)) {
51+
delete data[key]
52+
}
53+
})
4854
setRowsUpdating((oldState) => {
4955
oldState[rowId] = true
5056
return { ...oldState }
@@ -64,7 +70,7 @@ export function useUpdateRow(
6470
},
6571
})
6672
},
67-
[setData, tableId, updateRowMutation],
73+
[setData, tableId, tableColumns, updateRowMutation],
6874
)
6975
return {
7076
rowsUpdating,

packages/frontend/src/pages/Tile/hooks/useUpdateTable.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useCallback, useState } from 'react'
44
import { useMutation } from '@apollo/client'
55
import { type SetOptional } from 'type-fest'
66

7+
import { UpdateTableMutation } from '@/graphql/__generated__/graphql'
78
import { UPDATE_TABLE } from '@/graphql/mutations/tiles/update-table'
89
import { GET_TABLE } from '@/graphql/queries/tiles/get-table'
910

@@ -22,18 +23,14 @@ interface UpdateTableInput {
2223
}
2324
}
2425

25-
interface UpdateTableOutput {
26-
createRow: string
27-
}
28-
2926
export function useUpdateTable() {
3027
const { tableId } = useTableContext()
3128
const [isUpdatingTableName, setIsUpdatingTableName] = useState(false)
3229
const [isCreatingColumns, setIsCreatingColumns] = useState(false)
3330
const [isUpdatingColumns, setIsUpdatingColumns] = useState(false)
3431
const [isDeletingColumns, setIsDeletingColumns] = useState(false)
3532

36-
const [updateTable] = useMutation<UpdateTableOutput, UpdateTableInput>(
33+
const [updateTable] = useMutation<UpdateTableMutation, UpdateTableInput>(
3734
UPDATE_TABLE,
3835
{
3936
awaitRefetchQueries: true,

packages/types/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"name": "@plumber/types",
33
"description": "Shared types for plumber",
44
"types": "./index.d.ts",
5-
"version": "1.40.2"
5+
"version": "1.40.3"
66
}

0 commit comments

Comments
 (0)