Skip to content

Fix dcc.Upload contents and dcc.Geolocation position docstrings - #4126

Open
ZainnQureshii wants to merge 1 commit into
plotly:devfrom
ZainnQureshii:docs/dcc-upload-geolocation-docstrings
Open

ZainnQureshii wants to merge 1 commit into
plotly:devfrom
ZainnQureshii:docs/dcc-upload-geolocation-docstrings

Conversation

@ZainnQureshii

Copy link
Copy Markdown

Fixes #4125

Two dcc prop docstrings describe a value format the component does not produce:

  • dcc.Upload.contents said "binary string". The component reads each file with reader.readAsDataURL(file) (src/fragments/Upload.react.js:189) and pushes reader.result unchanged (:173), so the value is a base64 data URL. The docstring now says so and shows the data:<mime type>;base64,<data> shape.
  • dcc.Geolocation.position said unavailable fields are NaN. The component builds them with ?? null (src/components/Geolocation.react.js:59-65), so they arrive as null (None in a Python callback). The docstring now says null, which the Python generator already renders as None (fix_keywords in dash/development/_py_components_generation.py).

Docstrings only, no behavior change, so no test is added. The generated Python wrappers pick the text up on the next build.

Contributor Checklist

  • This PR targets dev (fix or chore) or next (feature, new API, breaking change), see Which branch to target
  • I have broken down my PR scope into the following TODO tasks
    • dcc.Upload contents docstring
    • dcc.Geolocation position docstring
  • I have run the tests locally and they passed. (refer to testing section in contributing)
  • I have added tests, or extended existing tests, to cover any new features or bugs fixed in this PR

optionals

  • I have added entry in the CHANGELOG.md
  • If this PR needs a follow-up in dash docs, community thread, I have mentioned the relevant URLS as follows
    • this GitHub #PR number updates the dash docs
    • here is the show and tell thread in Plotly Dash community

Prepared with AI assistance (Claude Code) and reviewed with GitHub Copilot.

Generated with Claude Code

Upload reads files with readAsDataURL, so contents is a base64 data URL,
not a binary string. Geolocation sets missing optional fields with
`?? null`, so they arrive as null, not NaN.

Fixes plotly#4125

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Nov 6, 2026

Copy link
Copy Markdown

@T4rk1n T4rk1n 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.

Both docstrings now match what the components do. Upload reads files with readAsDataURL and passes reader.result through unchanged, and Geolocation fills missing fields with ?? null. No changes needed from my side.

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.

[BUG] dcc.Upload contents and dcc.Geolocation position docstrings describe the wrong value format

2 participants