Skip to content

Commit

Permalink
ci: Format code
Browse files Browse the repository at this point in the history
  • Loading branch information
seambot committed Jan 20, 2025
1 parent 49a93b6 commit c6723fb
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/lib/seam/devices/use-set-device-name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,16 @@ export type UseSetDeviceNameParams = never

export type UseSetDeviceNameData = undefined

export type UseSetDeviceNameMutationVariables = Pick<DevicesUpdateBody, 'device_id' | 'name'>
export type UseSetDeviceNameMutationVariables = Pick<
DevicesUpdateBody,
'device_id' | 'name'
>

type MutationError = SeamHttpApiError

export function useSetDeviceName(params: DevicesGetParams): UseMutationResult<
export function useSetDeviceName(
params: DevicesGetParams
): UseMutationResult<
UseSetDeviceNameData,
MutationError,
UseSetDeviceNameMutationVariables
Expand All @@ -38,15 +43,17 @@ export function useSetDeviceName(params: DevicesGetParams): UseMutationResult<
await client.devices.update(variables)
},
onSuccess: (_data, variables) => {

queryClient.setQueryData<Device | null>(
['devices', 'get', params],
(device) => {
if (device == null) {
return
}

return getUpdatedDevice(device, variables.name ?? device.properties.name)
return getUpdatedDevice(
device,
variables.name ?? device.properties.name
)
}
)

Expand All @@ -59,7 +66,10 @@ export function useSetDeviceName(params: DevicesGetParams): UseMutationResult<

return devices.map((device) => {
if (device.device_id === variables.device_id) {
return getUpdatedDevice(device, variables.name ?? device.properties.name)
return getUpdatedDevice(
device,
variables.name ?? device.properties.name
)
}

return device
Expand All @@ -80,4 +90,4 @@ const getUpdatedDevice = (device: Device, name: string): Device => {
name,
},
}
}
}

0 comments on commit c6723fb

Please sign in to comment.