fix: removed comments

This commit is contained in:
Adam Gough
2025-05-17 21:45:33 -04:00
parent a0b27570f7
commit e9892d7f32
19 changed files with 17 additions and 259 deletions

View File

@@ -1,10 +1,8 @@
import { Checkbox } from '@/components/ui/checkbox'
import { Label } from '@/components/ui/label'
import { cn } from '@/lib/utils'
import { createLogger } from '@/lib/logs/console-logger'
import { useSubBlockValue } from '../hooks/use-sub-block-value'
const logger = createLogger('CheckboxList')
interface CheckboxListProps {
blockId: string
@@ -36,15 +34,6 @@ export function CheckboxList({
propValues?.[option.id]
)
// Log when in preview mode to verify it's working
if (isPreview) {
logger.info(`[PREVIEW] CheckboxList option ${option.id} for ${blockId}`, {
isPreview,
propValue: propValues?.[option.id],
value
});
}
return (
<div key={option.id} className='flex items-center space-x-2'>
<Checkbox

View File

@@ -201,18 +201,7 @@ export function Code({
clearTimeout(timeoutId)
resizeObserver.disconnect()
}
}, [code])
// Log when in preview mode to verify it's working
useEffect(() => {
if (isPreview) {
logger.info(`[PREVIEW] Code for ${blockId}:${subBlockId}`, {
isPreview,
propValue,
storeValue
});
}
}, [isPreview, propValue, storeValue, blockId, subBlockId]);
}, [code])
// Handlers
const handleDrop = (e: React.DragEvent) => {

View File

@@ -512,15 +512,15 @@ export function ConditionInput({ blockId, subBlockId, isConnecting, isPreview =
}, [conditionalBlocks.length])
// Log when in preview mode to verify it's working
useEffect(() => {
if (isPreview) {
logger.info(`[PREVIEW] ConditionInput for ${blockId}:${subBlockId}`, {
isPreview,
propValue,
storeValue
});
}
}, [isPreview, propValue, storeValue, blockId, subBlockId]);
// useEffect(() => {
// if (isPreview) {
// logger.info(`[PREVIEW] ConditionInput for ${blockId}:${subBlockId}`, {
// isPreview,
// propValue,
// storeValue
// });
// }
// }, [isPreview, propValue, storeValue, blockId, subBlockId]);
// Show loading or empty state if not ready or no blocks
if (!isReady || conditionalBlocks.length === 0) {

View File

@@ -7,11 +7,9 @@ import { Button } from '@/components/ui/button'
import { Calendar } from '@/components/ui/calendar'
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
import { cn } from '@/lib/utils'
import { createLogger } from '@/lib/logs/console-logger'
import { useNotificationStore } from '@/stores/notifications/store'
import { useSubBlockValue } from '../hooks/use-sub-block-value'
const logger = createLogger('DateInput')
interface DateInputProps {
blockId: string
@@ -26,17 +24,6 @@ export function DateInput({ blockId, subBlockId, placeholder, isPreview = false,
const addNotification = useNotificationStore((state) => state.addNotification)
const date = value ? new Date(value) : undefined
// Log when in preview mode to verify it's working
React.useEffect(() => {
if (isPreview) {
logger.info(`[PREVIEW] DateInput for ${blockId}:${subBlockId}`, {
isPreview,
propValue,
value
});
}
}, [isPreview, propValue, value, blockId, subBlockId]);
const isPastDate = React.useMemo(() => {
if (!date) return false
const today = new Date()

View File

@@ -3,10 +3,8 @@ import { Button } from '@/components/ui/button'
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
import { createLogger } from '@/lib/logs/console-logger'
import { useSubBlockValue } from '../hooks/use-sub-block-value'
const logger = createLogger('EvalInput')
interface EvalMetric {
id: string
@@ -38,15 +36,6 @@ export function EvalInput({ blockId, subBlockId, isPreview = false, value: propV
const [value, setValue] = useSubBlockValue<EvalMetric[]>(blockId, subBlockId, false, isPreview, propValue)
const metrics = value || [DEFAULT_METRIC]
// Log when in preview mode to verify it's working
if (isPreview) {
logger.info(`[PREVIEW] EvalInput for ${blockId}:${subBlockId}`, {
isPreview,
propValue,
value
});
}
// Metric operations
const addMetric = () => {
const newMetric: EvalMetric = {

View File

@@ -20,7 +20,6 @@ import { MicrosoftFileSelector } from './components/microsoft-file-selector'
import type { TeamsMessageInfo } from './components/teams-message-selector'
import { TeamsMessageSelector } from './components/teams-message-selector'
const logger = createLogger('FileSelectorInput')
interface FileSelectorInputProps {
blockId: string
@@ -48,16 +47,6 @@ export function FileSelectorInput({
const [selectedMessageId, setSelectedMessageId] = useState<string>('')
const [messageInfo, setMessageInfo] = useState<TeamsMessageInfo | null>(null)
// Log when in preview mode to verify it's working
useEffect(() => {
if (isPreview) {
logger.info(`[PREVIEW] FileSelectorInput for ${blockId}:${subBlock.id}`, {
isPreview,
propValue
});
}
}, [isPreview, propValue, blockId, subBlock.id]);
// Get provider-specific values
const provider = subBlock.provider || 'google-drive'
const isConfluence = provider === 'confluence'

View File

@@ -4,14 +4,12 @@ import { useEffect, useRef, useState } from 'react'
import { X } from 'lucide-react'
import { Button } from '@/components/ui/button'
import { Progress } from '@/components/ui/progress'
import { createLogger } from '@/lib/logs/console-logger'
import { useNotificationStore } from '@/stores/notifications/store'
import { useWorkflowRegistry } from '@/stores/workflows/registry/store'
import { useSubBlockStore } from '@/stores/workflows/subblock/store'
import { useWorkflowStore } from '@/stores/workflows/workflow/store'
import { useSubBlockValue } from '../hooks/use-sub-block-value'
const logger = createLogger('FileUpload')
interface FileUploadProps {
blockId: string
@@ -66,17 +64,6 @@ export function FileUpload({
const { addNotification } = useNotificationStore()
const { activeWorkflowId } = useWorkflowRegistry()
// Log when in preview mode to verify it's working
useEffect(() => {
if (isPreview) {
logger.info(`[PREVIEW] FileUpload for ${blockId}:${subBlockId}`, {
isPreview,
propValue,
value
});
}
}, [isPreview, propValue, value, blockId, subBlockId]);
/**
* Opens file dialog
* Prevents event propagation to avoid ReactFlow capturing the event

View File

@@ -1,13 +1,14 @@
'use client'
import { useEffect, useState } from 'react'
<<<<<<< HEAD
import type { SubBlockConfig } from '@/blocks/types'
import { createLogger } from '@/lib/logs/console-logger'
=======
>>>>>>> 86800d81 (fix: removed comments)
import { useSubBlockStore } from '@/stores/workflows/subblock/store'
import { type FolderInfo, FolderSelector } from '../folder-selector'
const logger = createLogger('FolderSelectorInput')
interface FolderSelectorInputProps {
blockId: string
subBlock: SubBlockConfig
@@ -27,16 +28,6 @@ export function FolderSelectorInput({
const [selectedFolderId, setSelectedFolderId] = useState<string>('')
const [_folderInfo, setFolderInfo] = useState<FolderInfo | null>(null)
// Log when in preview mode to verify it's working
useEffect(() => {
if (isPreview) {
logger.info(`[PREVIEW] FolderSelectorInput for ${blockId}:${subBlock.id}`, {
isPreview,
propValue
});
}
}, [isPreview, propValue, blockId, subBlock.id]);
// Get the current value from the store or prop value if in preview mode
useEffect(() => {
if (isPreview && propValue !== undefined) {

View File

@@ -2,15 +2,17 @@
import { useEffect, useState } from 'react'
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'
<<<<<<< HEAD
import type { SubBlockConfig } from '@/blocks/types'
import { createLogger } from '@/lib/logs/console-logger'
=======
>>>>>>> 86800d81 (fix: removed comments)
import { useSubBlockStore } from '@/stores/workflows/subblock/store'
import { type DiscordServerInfo, DiscordServerSelector } from './components/discord-server-selector'
import { type JiraProjectInfo, JiraProjectSelector } from './components/jira-project-selector'
import { type LinearProjectInfo, LinearProjectSelector } from './components/linear-project-selector'
import { type LinearTeamInfo, LinearTeamSelector } from './components/linear-team-selector'
const logger = createLogger('ProjectSelectorInput')
interface ProjectSelectorInputProps {
blockId: string
@@ -33,16 +35,6 @@ export function ProjectSelectorInput({
const [selectedProjectId, setSelectedProjectId] = useState<string>('')
const [_projectInfo, setProjectInfo] = useState<JiraProjectInfo | DiscordServerInfo | null>(null)
// Log when in preview mode to verify it's working
useEffect(() => {
if (isPreview) {
logger.info(`[PREVIEW] ProjectSelectorInput for ${blockId}:${subBlock.id}`, {
isPreview,
propValue
});
}
}, [isPreview, propValue, blockId, subBlock.id]);
// Get provider-specific values
const provider = subBlock.provider || 'jira'
const isDiscord = provider === 'discord'

View File

@@ -57,18 +57,6 @@ export function ScheduleConfig({
const [startWorkflow, setStartWorkflow] = useSubBlockValue(blockId, 'startWorkflow', false, isPreview, propValue?.startWorkflow)
const isScheduleEnabled = startWorkflow === 'schedule'
// Log when in preview mode to verify it's working
useEffect(() => {
if (isPreview) {
logger.info(`[PREVIEW] ScheduleConfig for ${blockId}`, {
isPreview,
propValue,
scheduleType,
startWorkflow
});
}
}, [isPreview, propValue, scheduleType, startWorkflow, blockId]);
// Function to check if schedule exists in the database
const checkSchedule = async () => {
setIsLoading(true)

View File

@@ -1,9 +1,7 @@
import { useEffect, useMemo } from 'react'
import { Slider } from '@/components/ui/slider'
import { createLogger } from '@/lib/logs/console-logger'
import { useSubBlockValue } from '../hooks/use-sub-block-value'
const logger = createLogger('SliderInput')
interface SliderInputProps {
min?: number
@@ -30,17 +28,6 @@ export function SliderInput({
}: SliderInputProps) {
const [value, setValue] = useSubBlockValue<number>(blockId, subBlockId, false, isPreview, propValue)
// Log when in preview mode to verify it's working
useEffect(() => {
if (isPreview) {
logger.info(`[PREVIEW] SliderInput for ${blockId}:${subBlockId}`, {
isPreview,
propValue,
value
});
}
}, [isPreview, propValue, value, blockId, subBlockId]);
// Clamp the value within bounds while preserving relative position when possible
const normalizedValue = useMemo(() => {
if (value === null) return defaultValue

View File

@@ -11,10 +11,8 @@ import {
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'
import { cn } from '@/lib/utils'
import { createLogger } from '@/lib/logs/console-logger'
import { useSubBlockValue } from '../../hooks/use-sub-block-value'
const logger = createLogger('InputFormat')
interface InputField {
id: string
@@ -43,17 +41,6 @@ export function InputFormat({ blockId, subBlockId, isPreview = false, value: pro
const [value, setValue] = useSubBlockValue<InputField[]>(blockId, subBlockId, false, isPreview, propValue)
const fields = value || [DEFAULT_FIELD]
// Log when in preview mode to verify it's working
useEffect(() => {
if (isPreview) {
logger.info(`[PREVIEW] InputFormat for ${blockId}:${subBlockId}`, {
isPreview,
propValue,
value
});
}
}, [isPreview, propValue, value, blockId, subBlockId]);
// Field operations
const addField = () => {
const newField: InputField = {

View File

@@ -1,10 +1,8 @@
import { useEffect } from 'react'
import { Label } from '@/components/ui/label'
import { Switch as UISwitch } from '@/components/ui/switch'
import { createLogger } from '@/lib/logs/console-logger'
import { useSubBlockValue } from '../hooks/use-sub-block-value'
const logger = createLogger('Switch')
interface SwitchProps {
blockId: string
@@ -23,17 +21,6 @@ export function Switch({
}: SwitchProps) {
const [value, setValue] = useSubBlockValue(blockId, subBlockId, false, isPreview, propValue)
// Log when in preview mode to verify it's working
useEffect(() => {
if (isPreview) {
logger.info(`[PREVIEW] Switch for ${blockId}:${subBlockId}`, {
isPreview,
propValue,
value
});
}
}, [isPreview, propValue, value, blockId, subBlockId]);
return (
<div className='flex flex-col gap-2'>
<Label className='font-medium text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70'>

View File

@@ -5,11 +5,9 @@ import { checkEnvVarTrigger, EnvVarDropdown } from '@/components/ui/env-var-drop
import { formatDisplayText } from '@/components/ui/formatted-text'
import { Input } from '@/components/ui/input'
import { checkTagTrigger, TagDropdown } from '@/components/ui/tag-dropdown'
import { createLogger } from '@/lib/logs/console-logger'
import { cn } from '@/lib/utils'
import { useSubBlockValue } from '../hooks/use-sub-block-value'
const logger = createLogger('Table')
interface TableProps {
columns: string[]
@@ -27,17 +25,6 @@ interface TableRow {
export function Table({ columns, blockId, subBlockId, isPreview = false, value: propValue }: TableProps) {
const [value, setValue] = useSubBlockValue(blockId, subBlockId, false, isPreview, propValue)
// Log when in preview mode to verify it's working
useEffect(() => {
if (isPreview) {
logger.info(`[PREVIEW] Table for ${blockId}:${subBlockId}`, {
isPreview,
propValue,
value
});
}
}, [isPreview, propValue, value, blockId, subBlockId]);
// Create refs for input elements
const inputRefs = useRef<Map<string, HTMLInputElement>>(new Map())

View File

@@ -5,11 +5,9 @@ import { Clock } from 'lucide-react'
import { Button } from '@/components/ui/button'
import { Input } from '@/components/ui/input'
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
import { createLogger } from '@/lib/logs/console-logger'
import { cn } from '@/lib/utils'
import { useSubBlockValue } from '../hooks/use-sub-block-value'
const logger = createLogger('TimeInput')
interface TimeInputProps {
blockId: string
@@ -31,17 +29,6 @@ export function TimeInput({
const [value, setValue] = useSubBlockValue<string>(blockId, subBlockId, true, isPreview, propValue)
const [isOpen, setIsOpen] = React.useState(false)
// Log when in preview mode to verify it's working
React.useEffect(() => {
if (isPreview) {
logger.info(`[PREVIEW] TimeInput for ${blockId}:${subBlockId}`, {
isPreview,
propValue,
value
});
}
}, [isPreview, propValue, value, blockId, subBlockId]);
// Convert 24h time string to display format (12h with AM/PM)
const formatDisplayTime = (time: string) => {
if (!time) return ''

View File

@@ -319,19 +319,6 @@ export function WebhookConfig({
// Store provider-specific configuration
const [providerConfig, setProviderConfig] = useSubBlockValue(blockId, 'providerConfig', false, isPreview, propValue?.providerConfig)
// Log when in preview mode to verify it's working
useEffect(() => {
if (isPreview) {
logger.info(`[PREVIEW] WebhookConfig for ${blockId}`, {
isPreview,
propValue,
webhookProvider,
webhookPath,
providerConfig
});
}
}, [isPreview, propValue, webhookProvider, webhookPath, providerConfig, blockId]);
// Reset provider config when provider changes
useEffect(() => {

View File

@@ -239,10 +239,6 @@ export function useSubBlockValue<T = any>(
// Update valueRef directly to use the preview value
valueRef.current = directValue;
logger.info(`[PREVIEW-DOM] Using direct subblock value for ${blockId}:${subBlockId}`, {
directValue,
storeValue
});
}
}
} else {
@@ -255,48 +251,6 @@ export function useSubBlockValue<T = any>(
}
}, [blockId, subBlockId, isPreview, directValue, storeValue]);
// Add logging to trace where values are coming from
useEffect(() => {
// Skip if we've already determined we're in preview mode
if (previewDataRef.current.isInPreview) return;
// Check if we're in preview context
let isPreviewContext = false;
let directSubBlockValue = null;
try {
// Try to find if this component is within a preview parent
const parentBlock = document.querySelector(`[data-id="${blockId}"]`);
if (parentBlock) {
isPreviewContext = parentBlock.closest('.preview-mode') != null;
// Try to find the parent data to see if subBlockValues was passed directly
const dataProps = parentBlock.getAttribute('data-props');
if (dataProps) {
const parsedProps = JSON.parse(dataProps);
directSubBlockValue = parsedProps?.data?.subBlockValues?.[subBlockId];
}
}
logger.info(`[DATA-TRACE] SubBlock value source for ${blockId}:${subBlockId}`, {
blockId,
subBlockId,
storeValueExists: storeValue !== undefined,
initialValueExists: initialValue !== null,
isPreviewContext,
hasDirectSubBlockValue: directSubBlockValue !== undefined && directSubBlockValue !== null,
valueFromStore: storeValue,
valueFromInitial: initialValue,
valueFromDirect: directSubBlockValue,
actuallyUsing: previewDataRef.current.isInPreview ? 'directValue' :
(storeValue !== undefined ? 'globalStore' :
(initialValue !== null ? 'initialValue' : 'null')),
});
} catch (e) {
// Ignore errors - this is just diagnostic logging
}
}, [blockId, subBlockId, storeValue, initialValue]);
// Check if this is an API key field that could be auto-filled
const isApiKey =
subBlockId === 'apiKey' || (subBlockId?.toLowerCase().includes('apikey') ?? false)

View File

@@ -2,11 +2,9 @@ import { useEffect } from 'react'
import { Info } from 'lucide-react'
import { Label } from '@/components/ui/label'
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
import { useWorkflowStore } from '@/stores/workflows/workflow/store'
import { getBlock } from '@/blocks/index'
import type { SubBlockConfig } from '@/blocks/types'
import { useSubBlockStore } from '@/stores/workflows/subblock/store'
import { useWorkflowStore } from '@/stores/workflows/workflow/store'
import { ChannelSelectorInput } from './components/channel-selector/channel-selector-input'
import { CheckboxList } from './components/checkbox-list'
import { Code } from './components/code'
import { ConditionInput } from './components/condition-input'
@@ -45,7 +43,6 @@ export function SubBlock({
isPreview = false,
previewValue = undefined
}: SubBlockProps) {
const handleMouseDown = (e: React.MouseEvent) => {
e.stopPropagation()
}

View File

@@ -8,7 +8,6 @@ import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip
import { parseCronToHumanReadable } from '@/lib/schedules/utils'
import { cn, formatDateTime, validateName } from '@/lib/utils'
import type { BlockConfig, SubBlockConfig } from '@/blocks/types'
import { createLogger } from '@/lib/logs/console-logger'
import { useExecutionStore } from '@/stores/execution/store'
import { useWorkflowRegistry } from '@/stores/workflows/registry/store'
import { mergeSubblockState } from '@/stores/workflows/utils'
@@ -17,8 +16,6 @@ import { ActionBar } from './components/action-bar/action-bar'
import { ConnectionBlocks } from './components/connection-blocks/connection-blocks'
import { SubBlock } from './components/sub-block/sub-block'
// Add logger for diagnostic logging
const logger = createLogger('WorkflowBlock')
interface WorkflowBlockProps {
type: string
@@ -36,19 +33,6 @@ interface WorkflowBlockProps {
export function WorkflowBlock({ id, data }: NodeProps<WorkflowBlockProps>) {
const { type, config, name, isActive: dataIsActive, isPending } = data
// Add logging for debug purposes
useEffect(() => {
if (data.isPreview === true) {
logger.info(`[PREVIEW-RENDER] Block ${id} rendering in preview mode`, {
blockId: id,
blockType: type,
subBlockValues: data.subBlockValues ? Object.keys(data.subBlockValues) : [],
hasDirectSubBlocks: Boolean(data.subBlockValues && Object.keys(data.subBlockValues).length > 0),
isReadOnly: data.isReadOnly,
});
}
}, [id, type, data.isPreview, data.subBlockValues, data.isReadOnly]);
// State management
const [isConnecting, setIsConnecting] = useState(false)
const [isEditing, setIsEditing] = useState(false)