Skip to content

Commit aa7dac5

Browse files
committed
fix(search): revalidate recent sources and polish state transitions
1 parent bad9bef commit aa7dac5

59 files changed

Lines changed: 29927 additions & 165 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apps/sim/app/o/[organizationId]/components/organization-sidebar/components/organization-header/organization-header.tsx‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,7 @@ export function OrganizationHeader({
145145
{logo}
146146
</DropdownMenuItem>
147147
</Tooltip.Trigger>
148-
<Tooltip.Content>
149-
{isUploadingLogo ? 'Uploading...' : 'Change logo'}
150-
</Tooltip.Content>
148+
<Tooltip.Content>{isUploadingLogo ? 'Uploading' : 'Change logo'}</Tooltip.Content>
151149
</Tooltip.Root>
152150
) : (
153151
logo

‎apps/sim/app/o/[organizationId]/components/search-landing-history.tsx‎

Lines changed: 42 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ export function SearchLandingHistory({
2424
const history = useSearchHistory(organizationId)
2525
const clear = useClearSearchHistory(organizationId, userId)
2626
const [selection, setSelection] = useState<'sources' | 'queries' | null>(null)
27-
const sources = history.data?.sources.slice(0, 5) ?? []
28-
const queries = history.data?.queries.slice(0, 5) ?? []
27+
const data = history.isError ? undefined : history.data
28+
const sources = data?.sources.slice(0, 5) ?? []
29+
const queries = data?.queries.slice(0, 5) ?? []
2930
const selected = selection ?? (sources.length > 0 ? 'sources' : 'queries')
3031
return (
3132
<div className={cn('w-full min-w-0', inter.className)}>
@@ -58,27 +59,46 @@ export function SearchLandingHistory({
5859
Clear history
5960
</Chip>
6061
</div>
61-
{selected === 'sources' ? (
62-
sources.length > 0 ? (
63-
sources.map((source) => <SourceCard key={source.url} source={source} dense />)
64-
) : (
65-
<p className='px-2 py-2 text-[var(--text-tertiary)] text-small'>
66-
Sources you open will appear here.
67-
</p>
68-
)
69-
) : queries.length > 0 ? (
70-
<div className='flex flex-col gap-1'>
71-
{queries.map(({ query }) => (
72-
<Chip key={query} fullWidth leftIcon={Clock} onClick={() => onSearch(query)}>
73-
{query}
74-
</Chip>
75-
))}
62+
<div className='grid grid-cols-1'>
63+
<div
64+
className={cn(
65+
'col-start-1 row-start-1 min-w-0',
66+
selected !== 'sources' && 'invisible'
67+
)}
68+
inert={selected !== 'sources'}
69+
aria-hidden={selected !== 'sources'}
70+
>
71+
{sources.length > 0 ? (
72+
sources.map((source) => <SourceCard key={source.url} source={source} dense />)
73+
) : (
74+
<p className='px-2 py-2 text-[var(--text-tertiary)] text-small'>
75+
Sources you open will appear here.
76+
</p>
77+
)}
78+
</div>
79+
<div
80+
className={cn(
81+
'col-start-1 row-start-1 min-w-0',
82+
selected !== 'queries' && 'invisible'
83+
)}
84+
inert={selected !== 'queries'}
85+
aria-hidden={selected !== 'queries'}
86+
>
87+
{queries.length > 0 ? (
88+
queries.map(({ query }) => (
89+
<div key={query} className='py-1'>
90+
<Chip fullWidth leftIcon={Clock} onClick={() => onSearch(query)}>
91+
{query}
92+
</Chip>
93+
</div>
94+
))
95+
) : (
96+
<p className='px-2 py-2 text-[var(--text-tertiary)] text-small'>
97+
Your recent searches will appear here.
98+
</p>
99+
)}
76100
</div>
77-
) : (
78-
<p className='px-2 py-2 text-[var(--text-tertiary)] text-small'>
79-
Your recent searches will appear here.
80-
</p>
81-
)}
101+
</div>
82102
</section>
83103
)}
84104
{history.isError && (

‎apps/sim/app/o/[organizationId]/integrations/disconnect-account-menu.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export function DisconnectAccountMenu({
5959
text={`Disconnect ${selected ? accountLabel(selected) : integrationName} from all ${integrationName} connections in this organization. Workflows using this account will also lose access. You can reconnect later.`}
6060
confirm={{
6161
label: 'Disconnect',
62-
pendingLabel: 'Disconnecting…',
62+
pendingLabel: 'Disconnecting',
6363
pending: disconnect.isPending,
6464
disabled: disconnect.isPending,
6565
onClick: () => {

‎apps/sim/app/o/[organizationId]/integrations/github-member-integration.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export function GitHubMemberIntegration({
4646
const description = account
4747
? `${accounts.map((entry) => entry.displayName).join(', ')} · ${account.status === 'needs_reauth' ? 'Reconnect required' : 'Connected'}`
4848
: loading
49-
? 'Loading connection…'
49+
? 'Loading connection'
5050
: failed
5151
? 'Could not load connection'
5252
: option
@@ -68,7 +68,7 @@ export function GitHubMemberIntegration({
6868
/>
6969
{failed ? (
7070
<Chip disabled={inventory.isFetching} onClick={() => void inventory.refetch()}>
71-
{inventory.isFetching ? 'Retrying…' : 'Retry'}
71+
{inventory.isFetching ? 'Retrying' : 'Retry'}
7272
</Chip>
7373
) : account?.status === 'needs_reauth' && option?.id === account.optionId ? (
7474
<Chip

‎apps/sim/app/o/[organizationId]/integrations/integrations.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ describe('grouped member integrations', () => {
766766
expect(mocks.nextPage).toHaveBeenCalledOnce()
767767
queryOverrides = { hasNextPage: true, isFetchingNextPage: true, isFetching: true }
768768
await render()
769-
expect(buttons('Checking…')[0]).toBeDisabled()
769+
expect(buttons('Checking')[0]).toBeDisabled()
770770
rows = [
771771
...rows,
772772
{ ...memberSource, connectorId: 'older-source', viewerMembership: membership },

‎apps/sim/app/o/[organizationId]/integrations/live-member-integrations.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export function LiveMemberIntegrations({ organizationId, search }: LiveMemberInt
6565
/>
6666
)
6767
if (!inventory.data || !policies.data || !secrets.data)
68-
return <SettingsEmptyState variant='inline'>Loading your connections…</SettingsEmptyState>
68+
return <SettingsEmptyState variant='inline'>Loading your connections</SettingsEmptyState>
6969
const data = inventory.data
7070
const approvals = new Map(policies.data.map((policy) => [policy.connectorType, policy]))
7171
const group = data.credentialGroup
@@ -210,7 +210,7 @@ export function LiveMemberIntegrations({ organizationId, search }: LiveMemberInt
210210
connect.variables.optionId === option?.id) ||
211211
('mcpServerId' in connect.variables &&
212212
connect.variables.mcpServerId === server?.id))
213-
? 'Connecting…'
213+
? 'Connecting'
214214
: accounts.length
215215
? 'Add account'
216216
: 'Connect'}

‎apps/sim/app/o/[organizationId]/integrations/member-integration-row.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export function MemberIntegrationRow({
116116
function description() {
117117
if (!configured) return waiting ? 'Finish connecting in the other tab' : 'Not connected'
118118
if (hasLoadError) return 'Could not load connection'
119-
if (sources.isPending) return 'Loading connection…'
119+
if (sources.isPending) return 'Loading connection'
120120
if (target) {
121121
if (waiting) return 'Finish connecting in the other tab'
122122
if (target.viewerMembership === 'needs_reauth') return 'Reconnect your account'
@@ -183,7 +183,7 @@ export function MemberIntegrationRow({
183183
)}
184184
{hasLoadError && (
185185
<Chip disabled={sources.isFetching} onClick={() => void sources.refetch()}>
186-
{sources.isFetching ? 'Retrying…' : 'Retry'}
186+
{sources.isFetching ? 'Retrying' : 'Retry'}
187187
</Chip>
188188
)}
189189
{canCheckConnections && (
@@ -193,7 +193,7 @@ export function MemberIntegrationRow({
193193
onClick={() => void sources.fetchNextPage({ cancelRefetch: false })}
194194
>
195195
{sources.isFetchingNextPage
196-
? 'Checking…'
196+
? 'Checking'
197197
: sources.isFetchNextPageError
198198
? 'Retry'
199199
: 'Check connections'}

‎apps/sim/app/o/[organizationId]/integrations/member-integrations-list.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export function MemberIntegrationsList({
127127
</>
128128
) : overview.isPending || integrations.isPending ? (
129129
<>
130-
<SettingsEmptyState variant='inline'>Loading integrations…</SettingsEmptyState>
130+
<SettingsEmptyState variant='inline'>Loading integrations</SettingsEmptyState>
131131
{githubRow}
132132
</>
133133
) : (
@@ -178,7 +178,7 @@ export function MemberIntegrationsList({
178178
<SettingsEmptyState variant='inline'>
179179
{!availability.isIntegrationAvailabilityReady ||
180180
(approved.has('slack') && 'slack'.includes(query) && slackInventory.isPending)
181-
? 'Loading integrations…'
181+
? 'Loading integrations'
182182
: search
183183
? 'No matching integrations.'
184184
: 'No integrations are available to connect.'}

‎apps/sim/app/o/[organizationId]/integrations/slack-search-actions.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ export function SlackSearchActions({ organizationId, token, userId }: SlackSearc
3737
disabled={retry.isPending}
3838
onClick={() => retry.mutate({ token })}
3939
>
40-
{retry.isPending ? 'Queuing…' : 'Retry question in Slack'}
40+
{retry.isPending ? 'Queuing' : 'Retry question in Slack'}
4141
</Chip>
4242
) : (
4343
<Chip disabled={status.isFetching} onClick={() => void status.refetch()}>
44-
{status.isFetching ? 'Checking…' : 'Check connection'}
44+
{status.isFetching ? 'Checking' : 'Check connection'}
4545
</Chip>
4646
))}
4747
<ChipLink

‎apps/sim/app/o/[organizationId]/providers/organization-provider.test.tsx‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*/
44
import { act } from 'react'
55
import { authClientMock, authClientMockFns } from '@sim/testing/mocks/auth-client.mock'
6+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
67
import { createRoot, type Root } from 'react-dom/client'
78
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
89

@@ -39,8 +40,10 @@ function ScimReader() {
3940

4041
let host: HTMLDivElement
4142
let root: Root
43+
let client: QueryClient
4244

4345
beforeEach(() => {
46+
client = new QueryClient()
4447
resetDeploymentShape()
4548
host = document.createElement('div')
4649
document.body.appendChild(host)
@@ -49,6 +52,7 @@ beforeEach(() => {
4952

5053
afterEach(() => {
5154
act(() => root.unmount())
55+
client.clear()
5256
host.remove()
5357
})
5458

@@ -69,9 +73,11 @@ describe('OrganizationProvider', () => {
6973

7074
act(() =>
7175
root.render(
72-
<OrganizationProvider context={context}>
73-
<ScimReader />
74-
</OrganizationProvider>
76+
<QueryClientProvider client={client}>
77+
<OrganizationProvider context={context}>
78+
<ScimReader />
79+
</OrganizationProvider>
80+
</QueryClientProvider>
7581
)
7682
)
7783

0 commit comments

Comments
 (0)