The sample code for this article has been uploaded to my
Github
Warehouse:/CNFeffery/dash-masterGitee synchronization repository address:/cnfeffery/dash-master
Hello everyone I'm Mr. Fei, todayDash
Posted.2.18.2
The version update, although it is only a minor version update, some of the content involved is still very important, and I'm going to introduce it to you in today's post.
The terminal executes the following command to set theDash
Upgrade to the latest version:
pip install dash -U
Pattern Matching Callback Function Performance Dramatically Improved
In previous releases, based on theALL
Pattern-matching constructed callback functions when the component involvedIt's a very large number.When the callback function is triggered, there is a noticeable lag.
As a simple example, we rendered the page with the1000A switching assembly that passesALL
Pattern matching callbacks, real-timestatisticiansthere arewhich (number)The switch is inshow (a ticket)state, before it was updated2.18.1
Under the version, you can see that every time you operate the switch, it is accompanied by a noticeable lag:
And the update to2.18.2
Afterward, it was so silky smooth 🥳:
The corresponding source code for the example is as follows:
import dash
from dash import html
import feffery_antd_components as fac
from feffery_dash_utils.style_utils import style
from import Input, Output, ALL
app = (__name__)
= (
[
f"Dashreleases:{dash.__version__}",
(
(
[
(
id={"type": "test-switch", "index": i}, checked=False
)
for i in range(1000)
],
wrap=True,
),
style=style(
height=300, overflow="auto", padding=5, border="1px solid #bfbfbf"
),
),
("Number of switches opened:0", ),
],
style=style(padding=50),
)
app.clientside_callback(
"(checked_list) => `Number of switches opened:${checked_list.filter(Boolean).length}`",
Output("test-output", "children"),
Input({"type": "test-switch", "index": ALL}, "checked"),
prevent_initial_call=True,
)
if __name__ == "__main__":
(debug=True)
In addition to this, the release update also adds a new function to the regular callbacks corresponding to theContext added
cookies
、headers
、path
、remote
、origin
and other attributes, for a complete description of the update please go to/plotly/dash/releases/tag/v2.18.2
。
This is what this article is all about, forDash
If you are interested in application development, please feel free to add the micro-signalCNFeffery
If you want to join us, please note "dash learning" to join our technical exchange group, and we will grow together.