diff --git a/.storybook/preview.tsx b/.storybook/preview.tsx
index 244f317a6..efb2ab4e9 100644
--- a/.storybook/preview.tsx
+++ b/.storybook/preview.tsx
@@ -65,28 +65,34 @@ const preview: Preview = {
},
},
decorators: [
- (
- Story,
- {
+ (Story, context) => {
+ const {
globals: {
publishableKey,
userIdentifierKey,
seamEndpoint,
simulatedOutage,
},
- }
- ) => {
+ } = context
+
+ const usableKey =
+ simulatedOutage === 'outage' ? 'seam_pk_3' : publishableKey
+
return (
-
+
)
},
diff --git a/src/lib/seam/components/AccessCodeTable/AccessCodeTable.tsx b/src/lib/seam/components/AccessCodeTable/AccessCodeTable.tsx
index ceb6c9c35..aa317deea 100644
--- a/src/lib/seam/components/AccessCodeTable/AccessCodeTable.tsx
+++ b/src/lib/seam/components/AccessCodeTable/AccessCodeTable.tsx
@@ -90,7 +90,7 @@ export function AccessCodeTable({
}: AccessCodeTableProps): JSX.Element {
useComponentTelemetry('AccessCodeTable')
- const { accessCodes, isInitialLoading, isError, error } = useAccessCodes({
+ const { accessCodes, isInitialLoading, isError, refetch } = useAccessCodes({
device_id: deviceId,
})
@@ -208,10 +208,6 @@ export function AccessCodeTable({
)
}
- if (isError) {
- return
{error?.message}
- }
-
return (
<>
+
+ {
+ void refetch()
+ },
+ }}
+ disableCloseButton
+ />
>
)
@@ -338,4 +347,6 @@ const t = {
loading: 'Loading access codes',
accesCodeUpdated: 'Access code updated',
accesCodeCreated: 'Access code created',
+ tryAgain: 'Try again',
+ fallbackErrorMessage: 'Access codes could not be loaded',
}
diff --git a/src/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleTable.tsx b/src/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleTable.tsx
index b2e086b6b..b8667ae95 100644
--- a/src/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleTable.tsx
+++ b/src/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleTable.tsx
@@ -17,6 +17,7 @@ import {
} from 'lib/seam/thermostats/climate-setting-schedules/use-climate-setting-schedules.js'
import { ContentHeader } from 'lib/ui/layout/ContentHeader.js'
import { LoadingToast } from 'lib/ui/LoadingToast/LoadingToast.js'
+import { Snackbar } from 'lib/ui/Snackbar/Snackbar.js'
import { EmptyPlaceholder } from 'lib/ui/Table/EmptyPlaceholder.js'
import { TableBody } from 'lib/ui/Table/TableBody.js'
import { TableHeader } from 'lib/ui/Table/TableHeader.js'
@@ -72,7 +73,7 @@ export function ClimateSettingScheduleTable({
}: ClimateSettingScheduleTableProps): JSX.Element {
useComponentTelemetry('ClimateSettingScheduleTable')
- const { climateSettingSchedules, isInitialLoading, isError, error } =
+ const { climateSettingSchedules, isInitialLoading, isError, refetch } =
useClimateSettingSchedules({
device_id: deviceId,
})
@@ -128,10 +129,6 @@ export function ClimateSettingScheduleTable({
)
}
- if (isError) {
- return {error?.message}
- }
-
return (
@@ -165,6 +162,19 @@ export function ClimateSettingScheduleTable({
onClimateSettingScheduleClick={handleClimateSettingScheduleClick}
/>
+
+ {
+ void refetch()
+ },
+ }}
+ disableCloseButton
+ />
)
}
@@ -201,4 +211,6 @@ const t = {
noClimateSettingSchedulesMessage:
'Sorry, no climate setting schedules were found',
loading: 'Loading schedules',
+ tryAgain: 'Try again',
+ fallbackErrorMessage: 'Climate settings could not be loaded',
}
diff --git a/src/lib/seam/components/DeviceTable/DeviceTable.tsx b/src/lib/seam/components/DeviceTable/DeviceTable.tsx
index 281cad53e..65e6b4453 100644
--- a/src/lib/seam/components/DeviceTable/DeviceTable.tsx
+++ b/src/lib/seam/components/DeviceTable/DeviceTable.tsx
@@ -22,6 +22,7 @@ import {
} from 'lib/seam/devices/use-devices.js'
import { ContentHeader } from 'lib/ui/layout/ContentHeader.js'
import { LoadingToast } from 'lib/ui/LoadingToast/LoadingToast.js'
+import { Snackbar } from 'lib/ui/Snackbar/Snackbar.js'
import { EmptyPlaceholder } from 'lib/ui/Table/EmptyPlaceholder.js'
import { TableBody } from 'lib/ui/Table/TableBody.js'
import { TableHeader } from 'lib/ui/Table/TableHeader.js'
@@ -77,7 +78,7 @@ export function DeviceTable({
}: DeviceTableProps = {}): JSX.Element {
useComponentTelemetry('DeviceTable')
- const { devices, isInitialLoading, isError, error } = useDevices({
+ const { devices, isInitialLoading, isError, refetch } = useDevices({
device_ids: deviceIds,
connected_account_ids: connectedAccountIds,
})
@@ -120,10 +121,6 @@ export function DeviceTable({
)
}
- if (isError) {
- return {error?.message}
- }
-
return (
@@ -154,6 +151,19 @@ export function DeviceTable({
+
+
{
+ void refetch()
+ },
+ }}
+ disableCloseButton
+ />
)
}
@@ -216,4 +226,6 @@ const t = {
devices: 'Devices',
noDevicesMessage: 'Sorry, no devices were found',
loading: 'Loading devices',
+ tryAgain: 'Try again',
+ fallbackErrorMessage: 'Devices could not be loaded',
}