Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .lintstagedrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const sh_cd = (directory, command) => {

module.exports = {
// Python checks (run from root, using root venv)
"dash/*.py": (filenames) => [
"dash/**/*.py": (filenames) => [
`${venvBin("python")} -m pylint --rcfile=.pylintrc ${filenames.join(
" "
)}`,
Expand Down
44 changes: 38 additions & 6 deletions dash/_dash_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

__version__ = "3.0.0"

_available_react_versions = {"18.3.1", "18.2.0", "16.14.0"}
_available_reactdom_versions = {"18.3.1", "18.2.0", "16.14.0"}
_available_react_versions = {"18.3.1", "18.2.0", "19.2.0"}
_available_reactdom_versions = {"18.3.1", "18.2.0", "19.2.0"}
_js_dist_dependencies: List[Dict[str, Any]] = [] # to be set by _set_react_version


Expand All @@ -19,19 +19,51 @@ def _set_react_version(v_react, v_reactdom=None):
assert v_react in _available_react_versions, react_err
assert v_reactdom in _available_reactdom_versions, reactdom_err

# React 19+ removed UMD builds, use umd-react package instead
is_react19 = v_react.startswith("19.")
is_reactdom19 = v_reactdom.startswith("19.")

if is_react19:
react_prod_url = (
f"https://unpkg.com/umd-react@{v_react}/dist/react.production.min.js"
)
react_dev_url = (
f"https://unpkg.com/umd-react@{v_react}/dist/react.development.js"
)
else:
react_prod_url = (
f"https://unpkg.com/react@{v_react}/umd/react.production.min.js"
)
react_dev_url = f"https://unpkg.com/react@{v_react}/umd/react.development.js"

if is_reactdom19:
reactdom_prod_url = (
f"https://unpkg.com/umd-react@{v_reactdom}/dist/react-dom.production.min.js"
)
reactdom_dev_url = (
f"https://unpkg.com/umd-react@{v_reactdom}/dist/react-dom.development.js"
)
else:
reactdom_prod_url = (
f"https://unpkg.com/react-dom@{v_reactdom}/umd/react-dom.production.min.js"
)
reactdom_dev_url = (
f"https://unpkg.com/react-dom@{v_reactdom}/umd/react-dom.development.js"
)

_js_dist_dependencies[:] = [
{
"external_url": {
"prod": [
"https://unpkg.com/@babel/polyfill@7.12.1/dist/polyfill.min.js",
f"https://unpkg.com/react@{v_react}/umd/react.production.min.js",
f"https://unpkg.com/react-dom@{v_reactdom}/umd/react-dom.production.min.js",
react_prod_url,
reactdom_prod_url,
"https://unpkg.com/prop-types@15.8.1/prop-types.min.js",
],
"dev": [
"https://unpkg.com/@babel/polyfill@7.12.1/dist/polyfill.min.js",
f"https://unpkg.com/react@{v_react}/umd/react.development.js",
f"https://unpkg.com/react-dom@{v_reactdom}/umd/react-dom.development.js",
react_dev_url,
reactdom_dev_url,
"https://unpkg.com/prop-types@15.8.1/prop-types.js",
],
},
Expand Down
40 changes: 36 additions & 4 deletions dash/dash-renderer/init.template
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,51 @@ def _set_react_version(v_react, v_reactdom=None):
assert v_react in _available_react_versions, react_err
assert v_reactdom in _available_reactdom_versions, reactdom_err

# React 19+ removed UMD builds, use umd-react package instead
is_react19 = v_react.startswith("19.")
is_reactdom19 = v_reactdom.startswith("19.")

if is_react19:
react_prod_url = (
f"https://unpkg.com/umd-react@{v_react}/dist/react.production.min.js"
)
react_dev_url = (
f"https://unpkg.com/umd-react@{v_react}/dist/react.development.js"
)
else:
react_prod_url = (
f"https://unpkg.com/react@{v_react}/umd/react.production.min.js"
)
react_dev_url = f"https://unpkg.com/react@{v_react}/umd/react.development.js"

if is_reactdom19:
reactdom_prod_url = (
f"https://unpkg.com/umd-react@{v_reactdom}/dist/react-dom.production.min.js"
)
reactdom_dev_url = (
f"https://unpkg.com/umd-react@{v_reactdom}/dist/react-dom.development.js"
)
else:
reactdom_prod_url = (
f"https://unpkg.com/react-dom@{v_reactdom}/umd/react-dom.production.min.js"
)
reactdom_dev_url = (
f"https://unpkg.com/react-dom@{v_reactdom}/umd/react-dom.development.js"
)

_js_dist_dependencies[:] = [
{
"external_url": {
"prod": [
"https://unpkg.com/@babel/polyfill@$polyfill/dist/polyfill.min.js",
f"https://unpkg.com/react@{v_react}/umd/react.production.min.js",
f"https://unpkg.com/react-dom@{v_reactdom}/umd/react-dom.production.min.js",
react_prod_url,
reactdom_prod_url,
"https://unpkg.com/prop-types@$proptypes/prop-types.min.js",
],
"dev": [
"https://unpkg.com/@babel/polyfill@$polyfill/dist/polyfill.min.js",
f"https://unpkg.com/react@{v_react}/umd/react.development.js",
f"https://unpkg.com/react-dom@{v_reactdom}/umd/react-dom.development.js",
react_dev_url,
reactdom_dev_url,
"https://unpkg.com/prop-types@$proptypes/prop-types.js",
],
},
Expand Down
18 changes: 16 additions & 2 deletions dash/development/build_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,21 @@ def bundles(self, build=None): # pylint:disable=too-many-locals
versions[f"extra_{name_squashed}_versions"] = f'"{extras_str}"'

for extra_version in extras:
url = f"https://unpkg.com/{name}@{extra_version}/umd/{filename}"
# React 19+ removed UMD builds, use umd-react package instead
if name in ("react", "react-dom") and extra_version.startswith(
"19."
):
# Map filename to umd-react dist path
if "production.min" in filename:
umd_filename = f"{name}.production.min.js"
elif "development" in filename:
umd_filename = f"{name}.development.js"
else:
umd_filename = filename
url = f"https://unpkg.com/umd-react@{extra_version}/dist/{umd_filename}"
else:
url = f"https://unpkg.com/{name}@{extra_version}/umd/{filename}"

res = requests.get(url)
extra_target = f"{name}@{extra_version}.{ext}"
extra_path = self._concat(self.deps_folder, extra_target)
Expand All @@ -169,7 +183,7 @@ def __init__(self):
"""dash-renderer's path is binding with the dash folder hierarchy."""
extras = [
"18.2.0",
"16.14.0",
"19.2.0",
] # versions to include beyond what's in package.json
super().__init__(
self._concat(os.path.dirname(__file__), os.pardir, "dash-renderer"),
Expand Down
Loading