[MAIN-IMP] Add job-focused proxy link dialog and fix dropdown stacking interactions#107
[MAIN-IMP] Add job-focused proxy link dialog and fix dropdown stacking interactions#107moda20 wants to merge 4 commits into
Conversation
disabling pointer events on job dropdown when another dialog is on top of it (same for the search bar)
📝 WalkthroughWalkthroughAdds end-to-end job-proxy linking: new Zod schemas and ChangesJob-Proxy Linking Feature
Sequence Diagram(s)sequenceDiagram
participant User
participant ActionDropdown
participant JobProxyLinkDialog
participant useProxies
participant systemService
User->>ActionDropdown: clicks "Linked Proxies" (meta+shift+p)
ActionDropdown->>JobProxyLinkDialog: opens dialog (jobDetails=row)
JobProxyLinkDialog->>systemService: getJobProxies(jobId) via useQuery
systemService-->>JobProxyLinkDialog: proxy list
User->>JobProxyLinkDialog: selects strategy + proxies, submits
JobProxyLinkDialog->>useProxies: proxyActions(LINK_TO_JOBS, jobProxyLinkData)
useProxies->>systemService: addProxiesToASingleJob(jobId, proxyIds)
systemService-->>useProxies: success
useProxies->>JobProxyLinkDialog: invalidates ["proxies"] cache
JobProxyLinkDialog->>ActionDropdown: onProxyStrategyChange(strategy, proxyId)
ActionDropdown->>ActionDropdown: updateProxyStrategy → dispatches jobActions.UPDATE
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
src/components/custom/ManagedSelect.tsxParsing error: ESLint was configured to run on
src/components/custom/jobsTable/actionDropdown.tsxParsing error: ESLint was configured to run on
src/components/custom/system/JobProxyLinkDialog.tsxParsing error: ESLint was configured to run on
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Update managedSelect component to better handle keyboard shortcuts and disabled prop
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/components/custom/jobsTable/actionDropdown.tsx`:
- Around line 174-186: The updateProxyStrategy callback function uses
JSON.parse() without error handling on row.param, which can throw an exception
if the param contains invalid JSON and break the proxy strategy update action.
Wrap the JSON.parse(row.param || "{}") call in a try-catch block to safely
handle parsing errors, falling back to an empty object {} if the parse fails,
ensuring the function continues execution and properly updates the proxyConfig
regardless of the param validity.
In `@src/components/custom/system/JobProxyLinkDialog.tsx`:
- Around line 69-72: The JSON.parse call in the useMemo hook for proxyConfig
lacks error handling and will throw an exception if jobDetails.param contains
malformed JSON, breaking the dialog render. Wrap the JSON.parse statement in a
try-catch block in the useMemo function to defensively handle parsing errors,
and return an empty object {} as the fallback when parsing fails. This will
ensure the dialog can still open even with invalid param data.
- Around line 164-168: The callback function passed to form.handleSubmit is not
returning the Promise from the handleSubmit(v) call, which causes async failures
and submission state to not propagate correctly. In the onSubmit handler within
the form.handleSubmit callback, return the Promise from handleSubmit(v) so that
the async operation completes and any errors are properly handled by the form
submission chain. This ensures that submission state remains accurate and
failures propagate as expected.
- Around line 75-87: The form.setValue() call in the select callback of useQuery
executes before the form object is declared, which will cause a runtime error.
Move the useForm hook initialization (with JobProxyLinkUpdateSchema) above the
useQuery hook so form is available. Then remove the form.setValue side effect
from the select callback entirely. Create a separate useEffect hook that watches
the jobProxyList data and calls form.setValue when the data changes. Finally,
add an enabled condition to the useQuery to check that jobDetails?.id exists
before executing the query, preventing unnecessary API calls when the job ID is
missing.
In `@src/models/proxies.ts`:
- Around line 79-84: The JobProxyLinkUpdateSchema has a contract mismatch
between the schema definition and its usage. The proxies field is marked as
optional with z.array(z.any()).optional() but the consumer code in useProxies
assumes it's always present and directly calls .map() on it, creating a
potential runtime error. Additionally, strategy accepts any string but the form
enforces ProxyStrategyOptionEnum values. Remove the .optional() modifier from
the proxies field to make it required since JobProxyLinkDialog always provides a
proxies array, and replace the z.string().optional() for strategy with a
z.enum() or z.union() constraint that validates only the allowed
ProxyStrategyOptionEnum values, ensuring the schema accurately reflects the
actual contract between the form producer and consumer hook.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: c94580f5-1115-40da-b5e6-87fa5d141787
📒 Files selected for processing (11)
package.jsonsrc/components/custom/DrawerMenuConfigurator.tsxsrc/components/custom/ManagedSelect.tsxsrc/components/custom/SearchBar.tsxsrc/components/custom/jobsTable/actionDropdown.tsxsrc/components/custom/system/JobProxyLinkDialog.tsxsrc/components/custom/system/ProxyConfigDialog.tsxsrc/components/ui/input-base.tsxsrc/hooks/useProxies.tsxsrc/models/proxies.tssrc/services/SystemService.ts
| const proxyConfig = useMemo(() => { | ||
| const jobParams = JSON.parse(jobDetails?.param ?? "{}") | ||
| return jobParams["proxyConfig"] | ||
| }, [jobDetails]) |
There was a problem hiding this comment.
Guard JSON parsing for jobDetails.param (Line 70).
A malformed param payload will throw during render and break opening this dialog. Parse defensively and fall back to {}.
Proposed fix
- const proxyConfig = useMemo(() => {
- const jobParams = JSON.parse(jobDetails?.param ?? "{}")
- return jobParams["proxyConfig"]
- }, [jobDetails])
+ const proxyConfig = useMemo(() => {
+ try {
+ const jobParams = JSON.parse(jobDetails?.param ?? "{}")
+ return jobParams?.proxyConfig
+ } catch {
+ return undefined
+ }
+ }, [jobDetails?.param])📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const proxyConfig = useMemo(() => { | |
| const jobParams = JSON.parse(jobDetails?.param ?? "{}") | |
| return jobParams["proxyConfig"] | |
| }, [jobDetails]) | |
| const proxyConfig = useMemo(() => { | |
| try { | |
| const jobParams = JSON.parse(jobDetails?.param ?? "{}") | |
| return jobParams?.proxyConfig | |
| } catch { | |
| return undefined | |
| } | |
| }, [jobDetails?.param]) |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/components/custom/system/JobProxyLinkDialog.tsx` around lines 69 - 72,
The JSON.parse call in the useMemo hook for proxyConfig lacks error handling and
will throw an exception if jobDetails.param contains malformed JSON, breaking
the dialog render. Wrap the JSON.parse statement in a try-catch block in the
useMemo function to defensively handle parsing errors, and return an empty
object {} as the fallback when parsing fails. This will ensure the dialog can
still open even with invalid param data.
| const { data: jobProxyList, isLoading } = useQuery({ | ||
| queryKey: ["proxies", jobDetails?.id], | ||
| queryFn: () => jobProxies(Number(jobDetails?.id)), | ||
| placeholderData: [], | ||
| select: data => { | ||
| form.setValue( | ||
| "proxies", | ||
| data.map(e => String(e.proxy_id)), | ||
| ) | ||
| return data | ||
| }, | ||
| }) | ||
| const form = useForm<z.infer<typeof JobProxyLinkUpdateSchema>>({ |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
In TanStack Query v5, can the selectcallback execute duringuseQueryresult derivation on initial render whenplaceholderData or cached data exists?
💡 Result:
Yes, in TanStack Query v5, the select callback does execute during the result derivation on the initial render when placeholderData or existing cached data is present [1][2]. When a query is initialized, TanStack Query processes the available data—whether it comes from the cache or is provided via placeholderData—through the select transformation if one is defined [1][2]. This ensures that the data returned by the useQuery hook consistently matches the expected shape dictated by your selector [3][2]. Key points regarding this behavior: 1. Consistency: The select function is applied to placeholderData just as it is to regular query results [1][2]. This ensures that components receive transformed data immediately, even while the query is in a pending or fetching state [1]. 2. Memoization: Because the select function can execute during render phases, you should memoize it (e.g., using useCallback or by defining it outside the component) to prevent unnecessary re-executions on every render, unless the selector's dependencies or the underlying data have changed [4][5][6]. 3. Performance: TanStack Query only re-runs the select function if the source data has changed or if the reference to the select function itself changes [4][6]. If neither has changed, it will return the previously calculated result [4].
Citations:
- 1: https://tanstack-query.mintlify.app/guides/placeholder-query-data
- 2: Feature/1824 transform placeholder data with select TanStack/query#2108
- 3: placeholderData is not transformed by select TanStack/query#1824
- 4: https://tanstack.com/query/v5/docs/framework/react/guides/render-optimizations
- 5: How to prevent query data selector function from running TanStack/query#2583
- 6: https://tanstack.com/query/latest/docs/framework/react/guides/render-optimizations
🏁 Script executed:
find . -type f -name "JobProxyLinkDialog.tsx" | head -5Repository: moda20/TypeSchedulerUI
Length of output: 120
🏁 Script executed:
cat -n ./src/components/custom/system/JobProxyLinkDialog.tsx | sed -n '70,95p'Repository: moda20/TypeSchedulerUI
Length of output: 1086
Move form initialization before useQuery and move select side effects to useEffect (Lines 75-95).
The select callback executes during initial render when placeholderData is set, causing form.setValue() to be called before form is declared. This will fail at runtime. Additionally, the query should not execute when jobDetails.id is missing.
Proposed fix
const form = useForm<z.infer<typeof JobProxyLinkUpdateSchema>>({
resolver: zodResolver(JobProxyLinkUpdateSchema),
defaultValues: {
id: jobDetails?.id ?? "",
- proxies: jobProxyList?.map(e => String(e.proxy_id)) ?? [],
+ proxies: [],
strategy: proxyConfig?.proxyStrategy,
proxyId: proxyConfig?.targetProxyId,
},
})
+ const { data: jobProxyList = [], isLoading } = useQuery({
+ queryKey: ["proxies", jobDetails?.id],
+ queryFn: () => jobProxies(Number(jobDetails!.id)),
+ placeholderData: [],
+ enabled: jobDetails?.id !== undefined && jobDetails?.id !== null,
+ })
+
+ useEffect(() => {
+ form.setValue(
+ "proxies",
+ jobProxyList.map(e => String(e.proxy_id)),
+ )
+ }, [form, jobProxyList])
- const { data: jobProxyList, isLoading } = useQuery({
- queryKey: ["proxies", jobDetails?.id],
- queryFn: () => jobProxies(Number(jobDetails?.id)),
- placeholderData: [],
- select: data => {
- form.setValue(
- "proxies",
- data.map(e => String(e.proxy_id)),
- )
- return data
- },
- })🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/components/custom/system/JobProxyLinkDialog.tsx` around lines 75 - 87,
The form.setValue() call in the select callback of useQuery executes before the
form object is declared, which will cause a runtime error. Move the useForm hook
initialization (with JobProxyLinkUpdateSchema) above the useQuery hook so form
is available. Then remove the form.setValue side effect from the select callback
entirely. Create a separate useEffect hook that watches the jobProxyList data
and calls form.setValue when the data changes. Finally, add an enabled condition
to the useQuery to check that jobDetails?.id exists before executing the query,
preventing unnecessary API calls when the job ID is missing.
| onSubmit={form.handleSubmit( | ||
| (v, event) => { | ||
| event.preventDefault() | ||
| handleSubmit(v) | ||
| }, |
There was a problem hiding this comment.
Return the async submit chain from form.handleSubmit (Lines 164-168).
The current callback drops the Promise from handleSubmit(v). Return/await it so failures propagate and submission state remains accurate.
Proposed fix
- onSubmit={form.handleSubmit(
- (v, event) => {
- event.preventDefault()
- handleSubmit(v)
- },
+ onSubmit={form.handleSubmit(
+ async (v, event) => {
+ event?.preventDefault()
+ await handleSubmit(v)
+ },
err => {
console.log(err)
},
)}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| onSubmit={form.handleSubmit( | |
| (v, event) => { | |
| event.preventDefault() | |
| handleSubmit(v) | |
| }, | |
| onSubmit={form.handleSubmit( | |
| async (v, event) => { | |
| event?.preventDefault() | |
| await handleSubmit(v) | |
| }, | |
| err => { | |
| console.log(err) | |
| }, | |
| )} |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/components/custom/system/JobProxyLinkDialog.tsx` around lines 164 - 168,
The callback function passed to form.handleSubmit is not returning the Promise
from the handleSubmit(v) call, which causes async failures and submission state
to not propagate correctly. In the onSubmit handler within the form.handleSubmit
callback, return the Promise from handleSubmit(v) so that the async operation
completes and any errors are properly handled by the form submission chain. This
ensures that submission state remains accurate and failures propagate as
expected.
| export const JobProxyLinkUpdateSchema = z.object({ | ||
| id: z.union([z.number(), z.string()]), | ||
| proxies: z.array(z.any()).optional(), | ||
| strategy: z.string().optional(), | ||
| proxyId: z.string().optional(), | ||
| }) |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify all producers/consumers of the LINK_TO_JOBS payload before tightening schema.
rg -nP --type=ts --type=tsx -C3 '\bJobProxyLinkUpdateSchema\b|\bJobProxyLinkUpdateType\b|\bProxyActions\.LINK_TO_JOBS\b|jobProxyLinkData!?\.proxies|onProxyStrategyChange\s*\(' srcRepository: moda20/TypeSchedulerUI
Length of output: 94
🏁 Script executed:
#!/bin/bash
# Fixed: search for schema, enum, and action definitions and usages
rg -n '(JobProxyLinkUpdateSchema|JobProxyLinkUpdateType|LINK_TO_JOBS|jobProxyLinkData.*proxies|ProxyStrategyOptionEnum|onProxyStrategyChange)' --type-list | head -20Repository: moda20/TypeSchedulerUI
Length of output: 456
🏁 Script executed:
#!/bin/bash
# Search for JobProxyLinkUpdateSchema definition and usage
rg -n 'JobProxyLinkUpdateSchema' src -A2 -B2Repository: moda20/TypeSchedulerUI
Length of output: 1487
🏁 Script executed:
#!/bin/bash
# Search for ProxyStrategyOptionEnum and strategy-related code
rg -n 'ProxyStrategyOptionEnum|ProxyStrategy' src -A1 -B1Repository: moda20/TypeSchedulerUI
Length of output: 3942
🏁 Script executed:
#!/bin/bash
# Check useProxies.tsx at line 198 area
fd 'useProxies.tsx' src -x cat -n {} | sed -n '190,210p'Repository: moda20/TypeSchedulerUI
Length of output: 782
🏁 Script executed:
#!/bin/bash
# Search for jobProxyLinkData initialization and form submissions
rg -n 'jobProxyLinkData\s*=' src -B2 -A2Repository: moda20/TypeSchedulerUI
Length of output: 48
🏁 Script executed:
#!/bin/bash
# Search for defaultValues in JobProxyLinkDialog and any other uses of JobProxyLinkUpdateSchema
rg -n 'defaultValues|JobProxyLinkUpdateType|ProxyActions\.LINK_TO_JOBS' src -B1 -A3Repository: moda20/TypeSchedulerUI
Length of output: 10172
🏁 Script executed:
#!/bin/bash
# Check mutations that consume JobProxyLinkUpdateType payload
rg -n 'jobLinkMutation|LINK_TO_JOBS' src -B2 -A2Repository: moda20/TypeSchedulerUI
Length of output: 1356
🏁 Script executed:
#!/bin/bash
# Find all calls to proxyActions with LINK_TO_JOBS
rg -n 'proxyActions.*LINK_TO_JOBS|ProxyActions\.LINK_TO_JOBS' srcRepository: moda20/TypeSchedulerUI
Length of output: 224
🏁 Script executed:
#!/bin/bash
# Check if JobProxyLinkUpdateType is used anywhere else besides JobProxyLinkDialog and type definitions
rg -n 'JobProxyLinkUpdateType' srcRepository: moda20/TypeSchedulerUI
Length of output: 595
Tighten JobProxyLinkUpdateSchema to eliminate data integrity risk in LINK_TO_JOBS payloads.
The schema at lines 79-84 declares proxies as z.array(z.any()).optional() and strategy as z.string().optional(), but the consumer at src/hooks/useProxies.tsx line 198 assumes proxies is always present: jobProxyLinkData!.proxies.map(e => Number(e)). This mismatch creates a contract violation—the form always provides a proxies array (line 91 of JobProxyLinkDialog.tsx defaults to []), but the schema permits undefined, leaving a runtime trap.
Additionally, strategy accepts any string while JobProxyLinkDialog enforces ProxyStrategyOptionEnum values in the form. Tighten the schema to match the actual contract:
Proposed schema fix
export const JobProxyLinkUpdateSchema = z.object({
- id: z.union([z.number(), z.string()]),
- proxies: z.array(z.any()).optional(),
- strategy: z.string().optional(),
+ id: z.coerce.number().int().positive(),
+ proxies: z.array(z.coerce.number().int().positive()).default([]),
+ strategy: z.nativeEnum(ProxyStrategyOptionEnum).optional(),
proxyId: z.string().optional(),
})🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/models/proxies.ts` around lines 79 - 84, The JobProxyLinkUpdateSchema has
a contract mismatch between the schema definition and its usage. The proxies
field is marked as optional with z.array(z.any()).optional() but the consumer
code in useProxies assumes it's always present and directly calls .map() on it,
creating a potential runtime error. Additionally, strategy accepts any string
but the form enforces ProxyStrategyOptionEnum values. Remove the .optional()
modifier from the proxies field to make it required since JobProxyLinkDialog
always provides a proxies array, and replace the z.string().optional() for
strategy with a z.enum() or z.union() constraint that validates only the allowed
ProxyStrategyOptionEnum values, ensuring the schema accurately reflects the
actual contract between the form producer and consumer hook.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
src/components/custom/system/JobProxyLinkDialog.tsx (2)
97-105: 🧹 Nitpick | 🔵 Trivial | 💤 Low valueMissing dependencies in
handlePickingStrategycallback.The callback references
form.setValueandstrategySelectRef.currentbut has an empty dependency array. WhileformfromuseFormis typically stable, the explicit empty array[]can be misleading. Consider addingformto deps for clarity.Suggested fix
}, - [], + [form], )🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/components/custom/system/JobProxyLinkDialog.tsx` around lines 97 - 105, The handlePickingStrategy callback function uses the form.setValue method but has an empty dependency array. Add the form object to the dependency array of the useCallback hook for clarity and to properly declare all dependencies used within the callback. This ensures the callback correctly tracks its external dependencies and prevents potential issues if the form reference were to change.
107-134:⚠️ Potential issue | 🟠 Major | ⚡ Quick winIncorrect and missing dependencies in
handleSubmitcallback.The dependency array includes
isDialogOpenwhich is not used in the callback body, while missing several identifiers that are used:proxyActions,onProxyStrategyChange, andsetDialogState. This can cause stale closure bugs.Proposed fix
}, - [onChange, isDialogOpen, proxyConfig], + [onChange, proxyActions, proxyConfig, onProxyStrategyChange, setDialogState], )🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/components/custom/system/JobProxyLinkDialog.tsx` around lines 107 - 134, The dependency array for the handleSubmit useCallback is incomplete and includes an unused dependency. Remove isDialogOpen from the dependency array since it is not used in the callback body. Add the missing dependencies that are actually used within the callback: proxyActions which is invoked to link jobs, onProxyStrategyChange which is called conditionally based on strategy changes, and setDialogState which is called to close the dialog. This will prevent stale closure bugs and ensure the callback is properly memoized.src/components/custom/jobsTable/actionDropdown.tsx (1)
176-196:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winLogic continues after parse error, corrupting data.
When
safeJsonParsereturns an error,oldParamcontains theErrorobject (not a parsed result). The code then callsset(oldParam, ...)on the Error object and serializes it withJSON.stringify, sending corrupted data to the backend. The function should return early on error or resetoldParamto{}.Proposed fix
const updateProxyStrategy = useCallback( (newStrategy?: string, specificProxyId?: string) => { - const { data: oldParam, error } = safeJsonParse(row.param || "{}") + let { data: oldParam, error } = safeJsonParse(row.param || "{}") if (error) { toast({ title: "Failed to parse Job params. this is a JSON parsing issue.", - description: oldParam?.toString(), + description: (oldParam as Error)?.message, variant: "destructive", }) + oldParam = {} // Reset to empty object to avoid corrupting data } set(oldParam, "proxyConfig.proxyStrategy", newStrategy)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/components/custom/jobsTable/actionDropdown.tsx` around lines 176 - 196, In the updateProxyStrategy function, when safeJsonParse detects an error, oldParam is set to the Error object instead of the parsed data, but the code continues to process it with the set() and unset() calls, causing corrupted data to be serialized. Add an early return statement immediately after the error toast is shown to prevent further processing when JSON parsing fails, or alternatively reset oldParam to an empty object {} when an error is detected so that subsequent operations work on valid data.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/components/custom/jobsTable/actionDropdown.tsx`:
- Around line 176-196: In the updateProxyStrategy function, when safeJsonParse
detects an error, oldParam is set to the Error object instead of the parsed
data, but the code continues to process it with the set() and unset() calls,
causing corrupted data to be serialized. Add an early return statement
immediately after the error toast is shown to prevent further processing when
JSON parsing fails, or alternatively reset oldParam to an empty object {} when
an error is detected so that subsequent operations work on valid data.
In `@src/components/custom/system/JobProxyLinkDialog.tsx`:
- Around line 97-105: The handlePickingStrategy callback function uses the
form.setValue method but has an empty dependency array. Add the form object to
the dependency array of the useCallback hook for clarity and to properly declare
all dependencies used within the callback. This ensures the callback correctly
tracks its external dependencies and prevents potential issues if the form
reference were to change.
- Around line 107-134: The dependency array for the handleSubmit useCallback is
incomplete and includes an unused dependency. Remove isDialogOpen from the
dependency array since it is not used in the callback body. Add the missing
dependencies that are actually used within the callback: proxyActions which is
invoked to link jobs, onProxyStrategyChange which is called conditionally based
on strategy changes, and setDialogState which is called to close the dialog.
This will prevent stale closure bugs and ensure the callback is properly
memoized.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 3e10f237-5e7e-4a1f-b269-0fbfcfa09ff9
📒 Files selected for processing (5)
src/components/custom/ManagedSelect.tsxsrc/components/custom/jobsTable/actionDropdown.tsxsrc/components/custom/system/JobProxyLinkDialog.tsxsrc/services/SystemService.tssrc/utils/generalUtils.ts
Improvements:
ProxyUpdateSchemaandProxyConfigUpdateTypeto shared models/proxies.tsNotes
getJobProxiesandaddProxiesToJobDrawerMenuConfiguratorhotkeys to only fire when drawer is open, this was a bug.How Has This Been Tested?
Related Issues
Screenshots (if applicable)
Additional Context
Summary by CodeRabbit