Skip to content

Commit e8ba1ab

Browse files
author
waleed
committed
cleaned up
1 parent 48f2ea2 commit e8ba1ab

File tree

2 files changed

+1
-13
lines changed

2 files changed

+1
-13
lines changed

apps/sim/hooks/use-trigger-config-aggregation.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ export function populateTriggerFieldsFromConfig(
137137
const currentValue = subBlockStore.getValue(blockId, subBlock.id)
138138

139139
let normalizedValue = configValue
140-
// Handle array fields - normalize strings to arrays, preserve arrays as-is
141140
if (subBlock.id === 'labelIds' || subBlock.id === 'folderIds') {
142141
if (typeof configValue === 'string' && configValue.trim() !== '') {
143142
try {
@@ -150,10 +149,8 @@ export function populateTriggerFieldsFromConfig(
150149
configValue !== null &&
151150
configValue !== undefined
152151
) {
153-
// If it's not already an array and not null/undefined, wrap it
154152
normalizedValue = [configValue]
155153
}
156-
// If it's already an array or null/undefined, use as-is
157154
}
158155

159156
if (currentValue === null || currentValue === undefined || currentValue === '') {

apps/sim/hooks/use-webhook-management.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,10 @@ export function useWebhookManagement({
8686
return
8787
}
8888

89-
// If already checked and webhookId exists, skip fetching
9089
if (alreadyChecked && currentWebhookId) {
9190
return
9291
}
9392

94-
// If already checked but webhookId is null, allow re-checking (handles timing issues)
9593
if (alreadyChecked && !currentWebhookId) {
9694
useSubBlockStore.setState((state) => {
9795
const newSet = new Set(state.checkedWebhooks)
@@ -114,10 +112,8 @@ export function useWebhookManagement({
114112

115113
try {
116114
const response = await fetch(`/api/webhooks?workflowId=${workflowId}&blockId=${blockId}`)
117-
const stillMounted = isMounted // Capture mount state at response time
115+
const stillMounted = isMounted
118116

119-
// Process response even if component unmounted, since we're using Zustand (global store)
120-
// The webhookId should be set in the store regardless of component lifecycle
121117
if (response.ok) {
122118
const data = await response.json()
123119

@@ -140,10 +136,8 @@ export function useWebhookManagement({
140136
}
141137

142138
if (webhook.providerConfig) {
143-
// Determine triggerId from multiple sources
144139
let effectiveTriggerId: string | undefined = triggerId
145140
if (!effectiveTriggerId) {
146-
// Try to get from stored value
147141
const storedTriggerId = useSubBlockStore.getState().getValue(blockId, 'triggerId')
148142
effectiveTriggerId =
149143
(typeof storedTriggerId === 'string' ? storedTriggerId : undefined) || undefined
@@ -155,7 +149,6 @@ export function useWebhookManagement({
155149
: undefined
156150
}
157151
if (!effectiveTriggerId) {
158-
// Try to determine from block config
159152
const workflowState = useWorkflowStore.getState()
160153
const block = workflowState.blocks?.[blockId]
161154
if (block) {
@@ -205,7 +198,6 @@ export function useWebhookManagement({
205198
useSubBlockStore.getState().setValue(blockId, 'webhookId', null)
206199
}
207200

208-
// Mark as checked even if component unmounted, since Zustand state persists
209201
useSubBlockStore.setState((state) => ({
210202
checkedWebhooks: new Set([...state.checkedWebhooks, blockId]),
211203
}))
@@ -233,7 +225,6 @@ export function useWebhookManagement({
233225
return () => {
234226
isMounted = false
235227
}
236-
// Note: Intentionally not including webhookId in dependencies to avoid re-running when it changes
237228
// eslint-disable-next-line react-hooks/exhaustive-deps
238229
}, [isPreview, triggerId, workflowId, blockId])
239230

0 commit comments

Comments
 (0)