Skip to content

fix(upload): resolve files in serialized callbacks - #7409

Merged
masenf merged 2 commits into
reflex-dev:mainfrom
kr1shna-exe:fix/7244-upload-callback-files
Nov 5, 2026
Merged

masenf merged 2 commits into
reflex-dev:mainfrom
kr1shna-exe:fix/7244-upload-callback-files

Conversation

@kr1shna-exe

@kr1shna-exe kr1shna-exe commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #7244. Uploads triggered by toast actions or rx.call_script callbacks fail because their generated payload reads a component-local filesById variable. The callback now reads the current selection through the shared runtime references.

What changed

  • Publish selected files from the upload provider without copying the file map.
  • Preserve provider discovery, custom handler parameter names and dynamic-ID metadata for ordinary upload buttons.
  • Add regression coverage for frontend/backend callbacks, toast action/cancel buttons, replacement selections, cleared selections and independent upload IDs.
  • Document callback uploads and add a reflex-base bugfix fragment.

Verification

  • Reproduced the browser ReferenceError before the fix.
  • Full unit suite: 11,188 passed, 155 skipped; 78.96% coverage.
  • Final upload unit tests: 73 passed.
  • Playwright toast/upload cases: 16 passed across development and production using Chrome.
  • Existing ordinary, direct-drop and streaming upload cases: 6 passed.
  • Ruff, formatting, stub generation and pyright reflex tests passed.
  • All other pre-commit hooks passed. Pyright across all tracked Python files passed with the Linux target used by CI; native macOS checking reports six existing affinity-API errors in unchanged benchmark files.

Deployment notes

No configuration changes are required. Callback examples continue to use documented literal upload IDs; general state-variable scope in serialized callbacks is unchanged.

Review in cubic

@kr1shna-exe
kr1shna-exe requested review from a team and Alek99 as code owners October 4, 2026 15:52

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 6 files

Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Upload callbacks now read the current selection through shared runtime references instead of a component-local variable.

  • Upload callbacks use the current files for their upload ID.

No actionable issues were found in the changes since the previous review. No previous review threads were supplied.

Reviews (2) · Last reviewed commit: "refactor(upload): reuse the provider app..." · Reviewed by Greptile

@codspeed

codspeed Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

⚠️ 22 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 148 untouched benchmarks


Comparing kr1shna-exe:fix/7244-upload-callback-files (f96d9e2) with main (26e84ac)

Open in CodSpeed

@masenf masenf added bug Something isn't working documentation Improvements or additions to documentation labels Oct 6, 2026
@FarhanAliRaza FarhanAliRaza added the on deck PRs lined up to review / merge next label Nov 4, 2026
Take the UploadFilesProvider app wrap from get_upload_files_context_var_data()
so its priority is defined in one place. Use the literal upload ID in the
direct-upload test, as the upload docs require.
@masenf
masenf merged commit b7b78ab into reflex-dev:main Nov 5, 2026
170 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation on deck PRs lined up to review / merge next

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rx.upload_files() from a toast action or call_script callback throws "ReferenceError: filesById is not defined" (the scenario #7156's changelog names)

3 participants