diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a62a864e2..fe154d3fc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to `dash` will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/). +## [1.16.3] - 2020-10-07 +### Fixed +- [#1426](https://github.com/plotly/dash/pull/1426) Fix a regression caused by `flask-compress==1.6.0` causing performance degradation on server requests + ## [1.16.2] - 2020-09-25 ### Fixed - [#1415](https://github.com/plotly/dash/pull/1415) Fix a regression with some layouts callbacks involving dcc.Tabs, not yet loaded dash_table.DataTable and dcc.Graph to not be called diff --git a/dash/dash.py b/dash/dash.py index cb3f7aae01..71ae894a24 100644 --- a/dash/dash.py +++ b/dash/dash.py @@ -20,6 +20,7 @@ import flask from flask_compress import Compress from werkzeug.debug.tbtools import get_current_traceback +from pkg_resources import get_distribution, parse_version import plotly import dash_renderer @@ -49,6 +50,8 @@ from . import _validate from . import _watch +_flask_compress_version = parse_version(get_distribution("flask-compress").version) + # Add explicit mapping for map files mimetypes.add_type("application/json", ".map", True) @@ -283,6 +286,16 @@ def __init__( else: raise ValueError("server must be a Flask app or a boolean") + if ( + self.server is not None + and not hasattr(self.server.config, "COMPRESS_ALGORITHM") + and _flask_compress_version >= parse_version("1.6.0") + ): + # flask-compress==1.6.0 changed default to ['br', 'gzip'] + # and non-overridable default compression with Brotli is + # causing performance issues + self.server.config["COMPRESS_ALGORITHM"] = ["gzip"] + base_prefix, routes_prefix, requests_prefix = pathname_configs( url_base_pathname, routes_pathname_prefix, requests_pathname_prefix ) diff --git a/dash/version.py b/dash/version.py index 9e54f289bf..6cc7415d1a 100644 --- a/dash/version.py +++ b/dash/version.py @@ -1 +1 @@ -__version__ = "1.16.2" +__version__ = "1.16.3"