Skip to content

handle var for clear selected files#5784

Merged
adhami3310 merged 2 commits intomainfrom
handle-var-for-clear-selected-files
Sep 12, 2025
Merged

handle var for clear selected files#5784
adhami3310 merged 2 commits intomainfrom
handle-var-for-clear-selected-files

Conversation

@adhami3310
Copy link
Member

No description provided.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Summary

This PR refactors the clear_selected_files function in the upload component to use a more type-safe approach for JavaScript function calls. The change replaces string interpolation-based JavaScript generation with the proper Var system pattern.

Key Changes:

  • Adds import for FunctionVar from reflex.vars.function
  • Replaces call_script(f"{func}({id_!r})") with run_script(Var("__clear_selected_files")._as_ref().to(FunctionVar).call(id_))

This change integrates well with Reflex's broader architecture by leveraging the framework's Var system, which is designed to handle type-safe variable operations and function calls. The Var system provides proper type checking and validation for JavaScript interop, making this approach more consistent with how other parts of the codebase handle dynamic function calls. The clear_selected_files function is part of the upload component's file management functionality, and this refactor ensures it follows the same patterns used elsewhere in the framework for JavaScript function invocation.

Confidence score: 4/5

  • This PR is safe to merge with minimal risk as it's a straightforward refactoring that improves type safety
  • Score reflects a well-structured change that follows established framework patterns and improves code quality
  • No files require special attention as the change is isolated and uses well-tested framework APIs

1 file reviewed, 1 comment

Edit Code Review Bot Settings | Greptile

@adhami3310 adhami3310 linked an issue Sep 11, 2025 that may be closed by this pull request
@codspeed-hq
Copy link

codspeed-hq bot commented Sep 11, 2025

CodSpeed Performance Report

Merging #5784 will not alter performance

Comparing handle-var-for-clear-selected-files (7e04a33) with main (f0b2075)

Summary

✅ 8 untouched

@adhami3310 adhami3310 merged commit 367b24d into main Sep 12, 2025
41 checks passed
@adhami3310 adhami3310 deleted the handle-var-for-clear-selected-files branch September 12, 2025 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upload id should be able to be a var

2 participants