fix(upload): resolve files in serialized callbacks

Merged
KR
1mo ago
+244-5

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.