The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix: datepicker querying bugs due to async function calls
TzeYiing7d589b30895a
diff --git a/studio/components/interfaces/Settings/Logs/LogsPreviewer.tsx b/studio/components/interfaces/Settings/Logs/LogsPreviewer.tsxindex 4fbf46470dd..e5a4eab3d60 100644--- a/studio/components/interfaces/Settings/Logs/LogsPreviewer.tsx+++ b/studio/components/interfaces/Settings/Logs/LogsPreviewer.tsx@@ -105,7 +105,7 @@ export const LogsPreviewer: React.FC<Props> = ({ projectRef, queryType, override})}- const handleSearch: LogSearchCallback = ({ query, to, from, fromMicro, toMicro }) => {+ const handleSearch: LogSearchCallback = async ({ query, to, from, fromMicro, toMicro }) => {let toValue, fromValueif (to || toMicro) {toValue = toMicro ? toMicro : dayjs(to).valueOf() * 1000@@ -129,8 +129,7 @@ export const LogsPreviewer: React.FC<Props> = ({ projectRef, queryType, override})}- console.log('queryType in LogsPreviewr', queryType)-+ console.log('queryType in LogsPreviewer', queryType)return (<div className="h-full flex flex-col flex-grow"><PreviewFilterPaneldiff --git a/studio/components/interfaces/Settings/Logs/PreviewFilterPanel.tsx b/studio/components/interfaces/Settings/Logs/PreviewFilterPanel.tsxindex ab906a43528..a6189f02403 100644--- a/studio/components/interfaces/Settings/Logs/PreviewFilterPanel.tsx+++ b/studio/components/interfaces/Settings/Logs/PreviewFilterPanel.tsx@@ -61,10 +61,6 @@ const PreviewFilterPanel: FC<Props> = ({}) => {const [search, setSearch] = useState('')- const [to, setTo] = useState({ value: '', error: '' })- const [from, setFrom] = useState({ value: '', error: '' })- const [defaultTimestamp, setDefaultTimestamp] = useState(dayjs().utc().toISOString())-const hasEdits = search !== defaultSearchValue// Sync local state with provided default value@@ -74,12 +70,6 @@ const PreviewFilterPanel: FC<Props> = ({}}, [defaultSearchValue])- useEffect(() => {- if (to.value !== defaultToValue) {- setTo({ value: defaultToValue, error: '' })- }- }, [defaultToValue])-const RefreshButton = () => (<Buttontype="default"@@ -112,7 +102,8 @@ const PreviewFilterPanel: FC<Props> = ({</Button>)- const handleSearch = () => onSearch({ query: search, to: to.value, from: from.value })+ const handleSearch = (partial: Partial<{ query: string; to: string; from: string }>) =>+ onSearch({ query: search, ...partial })return (<div@@ -124,7 +115,7 @@ const PreviewFilterPanel: FC<Props> = ({onSubmit={(e) => {// prevent redirectione.preventDefault()- handleSearch()+ handleSearch({})}}><Input@@ -134,7 +125,7 @@ const PreviewFilterPanel: FC<Props> = ({onChange={(e) => setSearch(e.target.value)}onBlur={(e: React.FocusEvent<HTMLInputElement>) => {setSearch(e.target.value)- handleSearch()+ handleSearch({query: e.target.value})}}icon={<div className="text-scale-900">@@ -145,7 +136,7 @@ const PreviewFilterPanel: FC<Props> = ({actions={hasEdits && (<button- onClick={() => handleSearch()}+ onClick={() => handleSearch({})}className="text-scale-1100 hover:text-scale-1200 mx-2">{'↲'}@@ -156,10 +147,8 @@ const PreviewFilterPanel: FC<Props> = ({</form><DatePickers- onChange={(e: any) => {- setFrom({ value: e.from, error: '' })- setTo({ value: e.to, error: '' })- handleSearch()+ onChange={async (e: { to: string; from: string }) => {+ handleSearch(e)}}to={defaultToValue}from={defaultFromValue}