-
Notifications
You must be signed in to change notification settings - Fork 33
Conversation
The mechanism of choosing version is not clear. |
@utyf You're totally right. I just realized this last night. I'm going to close this PR for now. There's another (ugly) monkeypatch example in this PR: plotly/dash-core-components#160 |
maybe we need to do something like this: def _set_react_version(react_version):
assert react_version in _REACT_VERSION_TYPES
# Dash renderer's dependencies get loaded in a special order by the server:
# React bundles first, the renderer bundle at the very end.
setattr(_this_module, '_js_dist_dependencies', [{
'external_url': _REACT_VERSION_TO_URLS[react_version]['external_url'],
'relative_package_path': _REACT_VERSION_TO_URLS[react_version]['relative_package_path'],
'namespace': 'dash_renderer'
}])
setattr(_this_module, '_js_dist', [{
'relative_package_path': 'bundle.js',
"external_url": (
'https://unpkg.com/dash-renderer@{}'
'/dash_renderer/bundle.js'
).format(__version__),
'namespace': 'dash_renderer'
}])
_set_react_version('15.4.2') and then, in the code: import dash_renderer
dash_renderer._set_react_version('16.2.0') |
…eact version from a dash application. Adds test for scripts versions served by Dash. Updates CHANGELOG to reflect new usage
That works. Adding and reopening with that. From the updated CHANGELOG:
All previous tests still pass. Added another test to make sure that this actually updates the React version for a Thanks, @utyf ! |
This looks good to me! Thank you very much for adding the test. Anything else you would like to add @mjclawar before I merge? |
@chriddyp no I think this covers everything as long as you are OK with the Probably also will want to bump the default minimum React version to 15.6 soon to at least warn other dash component authors about |
@chriddyp anything else you need to see on this? |
Any news on the topic? |
@chriddyp Checking in to see if you want anything else here to accept the PR. We're looking forward to using React 16 for all our Dash applications! |
Sorry for the delay on this one! This looks good to me, I'll merge now and press a new release 🍻 |
just published: |
Description
This adds optional React 16 support by allowing the developer to modify the React version served using, e.g.:
The default
REACT_VERSION
remains 15.4.2Other changes