Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,17 @@ jobs:
with:
node-version: latest

- name: Cache Bun dependencies
uses: actions/cache@v4
- name: Mount Bun cache (Sticky Disk)
uses: useblacksmith/stickydisk@v1
with:
path: |
~/.bun/install/cache
node_modules
**/node_modules
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-
key: ${{ github.repository }}-bun-cache
path: ~/.bun/install/cache

- name: Mount node_modules (Sticky Disk)
uses: useblacksmith/stickydisk@v1
with:
key: ${{ github.repository }}-node-modules
path: ./node_modules

- name: Install dependencies
run: bun install --frozen-lockfile
Expand Down
11 changes: 11 additions & 0 deletions apps/sim/app/_styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,17 @@
color: var(--text-primary);
}

/**
* Subblock divider visibility
* Hides dividers when adjacent subblocks render empty content (e.g., schedule-info without data).
* Uses CSS :has() to detect empty .subblock-content elements and hide associated dividers.
* Selectors ordered by ascending specificity: (0,4,0) then (0,5,0)
*/
.subblock-row:has(> .subblock-content:empty) > .subblock-divider,
.subblock-row:has(+ .subblock-row > .subblock-content:empty) > .subblock-divider {
display: none;
}

/**
* Dark mode specific overrides
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
import { useMemo } from 'react'
import { createLogger } from '@sim/logger'
import { Check } from 'lucide-react'
import { Button, Modal, ModalBody, ModalContent, ModalFooter, ModalHeader } from '@/components/emcn'
import {
Badge,
Button,
Modal,
ModalBody,
ModalContent,
ModalFooter,
ModalHeader,
} from '@/components/emcn'
import { client } from '@/lib/auth/auth-client'
import {
getProviderIdFromServiceId,
Expand Down Expand Up @@ -407,9 +415,9 @@ export function OAuthRequiredModal({
<div className='flex flex-1 items-center gap-[8px] text-[12px] text-[var(--text-primary)]'>
<span>{getScopeDescription(scope)}</span>
{newScopesSet.has(scope) && (
<span className='inline-flex items-center gap-[6px] rounded-[6px] bg-[#fde68a] px-[7px] py-[1px] font-medium text-[#a16207] text-[11px] dark:bg-[rgba(245,158,11,0.2)] dark:text-[#fcd34d]'>
<Badge variant='amber' size='sm'>
New
</span>
</Badge>
)}
</div>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ export function CredentialSelector({
)

return (
<>
<div>
<Combobox
options={comboboxOptions}
value={inputValue}
Expand All @@ -247,9 +247,20 @@ export function CredentialSelector({
/>

{needsUpdate && (
<div className='mt-2 flex items-center justify-between rounded-[6px] border border-amber-300/40 bg-amber-50/60 px-2 py-1 font-medium text-[12px] transition-colors dark:bg-amber-950/10'>
<span>Additional permissions required</span>
{!isForeign && <Button onClick={() => setShowOAuthModal(true)}>Update access</Button>}
<div className='mt-[8px] flex flex-col gap-[4px] rounded-[4px] border bg-[var(--surface-2)] px-[8px] py-[6px]'>
<div className='flex items-center font-medium text-[12px]'>
<span className='mr-[6px] inline-block h-[6px] w-[6px] rounded-[2px] bg-amber-500' />
Additional permissions required
</div>
{!isForeign && (
<Button
variant='active'
onClick={() => setShowOAuthModal(true)}
className='w-full px-[8px] py-[4px] font-medium text-[12px]'
>
Update access
</Button>
)}
</div>
)}

Expand All @@ -264,7 +275,7 @@ export function CredentialSelector({
serviceId={serviceId}
/>
)}
</>
</div>
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ export function McpDynamicArgs({
}

return (
<div className='relative space-y-4'>
<div className='relative'>
{/* Hidden dummy inputs to prevent browser password manager autofill */}
<input
type='text'
Expand All @@ -563,28 +563,30 @@ export function McpDynamicArgs({
tabIndex={-1}
readOnly
/>
{toolSchema.properties &&
Object.entries(toolSchema.properties).map(([paramName, paramSchema]) => {
const inputType = getInputType(paramSchema as any)
const showLabel = inputType !== 'switch'

return (
<div key={paramName} className='space-y-2'>
{showLabel && (
<Label
className={cn(
'font-medium text-sm',
toolSchema.required?.includes(paramName) &&
'after:ml-1 after:text-red-500 after:content-["*"]'
)}
>
{formatParameterLabel(paramName)}
</Label>
)}
{renderParameterInput(paramName, paramSchema as any)}
</div>
)
})}
<div className='space-y-4'>
{toolSchema.properties &&
Object.entries(toolSchema.properties).map(([paramName, paramSchema]) => {
const inputType = getInputType(paramSchema as any)
const showLabel = inputType !== 'switch'

return (
<div key={paramName} className='space-y-2'>
{showLabel && (
<Label
className={cn(
'font-medium text-sm',
toolSchema.required?.includes(paramName) &&
'after:ml-1 after:text-red-500 after:content-["*"]'
)}
>
{formatParameterLabel(paramName)}
</Label>
)}
{renderParameterInput(paramName, paramSchema as any)}
</div>
)
})}
</div>
</div>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export function ToolCredentialSelector({
)

return (
<>
<div>
<Combobox
options={comboboxOptions}
value={inputValue}
Expand All @@ -217,9 +217,20 @@ export function ToolCredentialSelector({
/>

{needsUpdate && (
<div className='mt-2 flex items-center justify-between rounded-[6px] border border-amber-300/40 bg-amber-50/60 px-2 py-1 font-medium text-[12px] transition-colors dark:bg-amber-950/10'>
<span>Additional permissions required</span>
{!isForeign && <Button onClick={() => setShowOAuthModal(true)}>Update access</Button>}
<div className='mt-[8px] flex flex-col gap-[4px] rounded-[4px] border bg-[var(--surface-2)] px-[8px] py-[6px]'>
<div className='flex items-center font-medium text-[12px]'>
<span className='mr-[6px] inline-block h-[6px] w-[6px] rounded-[2px] bg-amber-500' />
Additional permissions required
</div>
{!isForeign && (
<Button
variant='active'
onClick={() => setShowOAuthModal(true)}
className='w-full px-[8px] py-[4px] font-medium text-[12px]'
>
Update access
</Button>
)}
</div>
)}

Expand All @@ -234,7 +245,7 @@ export function ToolCredentialSelector({
serviceId={serviceId}
/>
)}
</>
</div>
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ function SubBlockComponent({
}

return (
<div onMouseDown={handleMouseDown} className='flex flex-col gap-[10px]'>
<div onMouseDown={handleMouseDown} className='subblock-content flex flex-col gap-[10px]'>
{renderLabel(
config,
isValidJson,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ export function Editor() {
)

return (
<div key={stableKey}>
<div key={stableKey} className='subblock-row'>
<SubBlock
blockId={currentBlockId}
config={subBlock}
Expand All @@ -352,7 +352,7 @@ export function Editor() {
allowExpandInPreview={false}
/>
{index < subBlocks.length - 1 && (
<div className='px-[2px] pt-[16px] pb-[13px]'>
<div className='subblock-divider px-[2px] pt-[16px] pb-[13px]'>
<div
className='h-[1.25px]'
style={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ export function useWand({
})

setTimeout(() => {
queryClient.invalidateQueries({ queryKey: subscriptionKeys.user() })
queryClient.invalidateQueries({ queryKey: subscriptionKeys.all })
}, 1000)
} catch (error: any) {
if (error.name === 'AbortError') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ export function useWorkflowExecution() {

// Invalidate subscription queries to update usage
setTimeout(() => {
queryClient.invalidateQueries({ queryKey: subscriptionKeys.user() })
queryClient.invalidateQueries({ queryKey: subscriptionKeys.all })
}, 1000)

safeEnqueue(encodeSSE({ event: 'final', data: result }))
Expand Down Expand Up @@ -646,7 +646,7 @@ export function useWorkflowExecution() {

// Invalidate subscription queries to update usage
setTimeout(() => {
queryClient.invalidateQueries({ queryKey: subscriptionKeys.user() })
queryClient.invalidateQueries({ queryKey: subscriptionKeys.all })
}, 1000)
}
return result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export function CancelSubscription({ subscription, subscriptionData }: CancelSub
logger.info('Subscription restored successfully', result)
}

await queryClient.invalidateQueries({ queryKey: subscriptionKeys.user() })
await queryClient.invalidateQueries({ queryKey: subscriptionKeys.all })
if (activeOrgId) {
await queryClient.invalidateQueries({ queryKey: organizationKeys.detail(activeOrgId) })
await queryClient.invalidateQueries({ queryKey: organizationKeys.billing(activeOrgId) })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export function UsageIndicator({ onClick }: UsageIndicatorProps) {
useEffect(() => {
const handleOperationConfirmed = () => {
setTimeout(() => {
queryClient.invalidateQueries({ queryKey: subscriptionKeys.user() })
queryClient.invalidateQueries({ queryKey: subscriptionKeys.all })
}, 1000)
}
onOperationConfirmed(handleOperationConfirmed)
Expand Down
26 changes: 17 additions & 9 deletions apps/sim/hooks/queries/subscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ export function useUpdateUsageLimit() {
return response.json()
},
onMutate: async ({ limit }) => {
await queryClient.cancelQueries({ queryKey: subscriptionKeys.user() })
await queryClient.cancelQueries({ queryKey: subscriptionKeys.usage() })
await queryClient.cancelQueries({ queryKey: subscriptionKeys.all })

const previousSubscriptionData = queryClient.getQueryData(subscriptionKeys.user())
const previousSubscriptionData = queryClient.getQueryData(subscriptionKeys.user(false))
const previousSubscriptionDataWithOrg = queryClient.getQueryData(subscriptionKeys.user(true))
const previousUsageData = queryClient.getQueryData(subscriptionKeys.usage())

queryClient.setQueryData(subscriptionKeys.user(), (old: any) => {
const updateSubscriptionData = (old: any) => {
if (!old) return old
const currentUsage = old.data?.usage?.current || 0
const newPercentUsed = limit > 0 ? (currentUsage / limit) * 100 : 0
Expand All @@ -120,7 +120,10 @@ export function useUpdateUsageLimit() {
},
},
}
})
}

queryClient.setQueryData(subscriptionKeys.user(false), updateSubscriptionData)
queryClient.setQueryData(subscriptionKeys.user(true), updateSubscriptionData)

queryClient.setQueryData(subscriptionKeys.usage(), (old: any) => {
if (!old) return old
Expand All @@ -133,19 +136,24 @@ export function useUpdateUsageLimit() {
}
})

return { previousSubscriptionData, previousUsageData }
return { previousSubscriptionData, previousSubscriptionDataWithOrg, previousUsageData }
},
onError: (_err, _variables, context) => {
if (context?.previousSubscriptionData) {
queryClient.setQueryData(subscriptionKeys.user(), context.previousSubscriptionData)
queryClient.setQueryData(subscriptionKeys.user(false), context.previousSubscriptionData)
}
if (context?.previousSubscriptionDataWithOrg) {
queryClient.setQueryData(
subscriptionKeys.user(true),
context.previousSubscriptionDataWithOrg
)
}
if (context?.previousUsageData) {
queryClient.setQueryData(subscriptionKeys.usage(), context.previousUsageData)
}
},
onSettled: () => {
queryClient.invalidateQueries({ queryKey: subscriptionKeys.user() })
queryClient.invalidateQueries({ queryKey: subscriptionKeys.usage() })
queryClient.invalidateQueries({ queryKey: subscriptionKeys.all })
},
})
}
Expand Down
2 changes: 1 addition & 1 deletion apps/sim/stores/panel/copilot/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2661,7 +2661,7 @@ export const useCopilotStore = create<CopilotStore>()(
// Invalidate subscription queries to update usage
setTimeout(() => {
const queryClient = getQueryClient()
queryClient.invalidateQueries({ queryKey: subscriptionKeys.user() })
queryClient.invalidateQueries({ queryKey: subscriptionKeys.all })
}, 1000)
} finally {
clearTimeout(timeoutId)
Expand Down
Loading
Loading