Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: fix failing tests

TzeYiing787a618dc5e5
diff --git a/studio/components/interfaces/Settings/Logs/LogsPreviewer.tsx b/studio/components/interfaces/Settings/Logs/LogsPreviewer.tsx
index 80dc404e89e..4fbf46470dd 100644
--- a/studio/components/interfaces/Settings/Logs/LogsPreviewer.tsx
+++ b/studio/components/interfaces/Settings/Logs/LogsPreviewer.tsx
@@ -173,12 +173,14 @@ export const LogsPreviewer: React.FC<Props> = ({ projectRef, queryType, override
}
>
<div className={condensedLayout ? 'px-4' : ''}>
- <LogEventChart
- data={!isLoading ? logData : undefined}
- onBarClick={(timestampMicro) => {
- handleSearch({ query: filters.search_query, toMicro: timestampMicro })
- }}
- />
+ {showChart && (
+ <LogEventChart
+ data={!isLoading ? logData : undefined}
+ onBarClick={(timestampMicro) => {
+ handleSearch({ query: filters.search_query, toMicro: timestampMicro })
+ }}
+ />
+ )}
</div>
</div>
<div className="flex flex-col flex-grow relative pt-4">
diff --git a/studio/components/ui/CSVButton.tsx b/studio/components/ui/CSVButton.tsx
index 697c40df5fa..edc65394bd1 100644
--- a/studio/components/ui/CSVButton.tsx
+++ b/studio/components/ui/CSVButton.tsx
@@ -28,7 +28,7 @@ const CSVButton: React.FC<Props> = ({
}
const formattedData = useMemo(() => {
const first = data?.[0]
- if (!first) return
+ if (!first || !data) return
const keys = Object.keys(first as any)
return data.map((datum: any) => {
return keys.reduce((acc: any, key) => {
diff --git a/studio/tests/pages/projects/LogsPreviewer.test.js b/studio/tests/pages/projects/LogsPreviewer.test.js
index 5db1c8ee6dc..70497220eab 100644
--- a/studio/tests/pages/projects/LogsPreviewer.test.js
+++ b/studio/tests/pages/projects/LogsPreviewer.test.js
@@ -257,7 +257,7 @@ test('bug: load older btn does not error out when previous page is empty', async
test('log event chart hide', async () => {
render(<LogsPreviewer projectRef="123" tableName={LogsTableName.EDGE} />)
await screen.findByText('Events')
- const toggle = await screen.findByText(/Histogram/)
+ const toggle = await screen.findByText(/Event chart/)
userEvent.click(toggle)
await expect(screen.findByText('Events')).rejects.toThrow()
})