From 1e019a996d058b804e12cce017cbbb084668f204 Mon Sep 17 00:00:00 2001 From: BSd3v <82055130+BSd3v@users.noreply.github.com> Date: Mon, 3 Feb 2025 06:48:22 -0500 Subject: [PATCH 01/11] adjustments for dash 3 support --- src/lib/fragments/AgGrid.react.js | 11 +++++------ tests/test_column_state.py | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/lib/fragments/AgGrid.react.js b/src/lib/fragments/AgGrid.react.js index fa4d8138..4a190af6 100644 --- a/src/lib/fragments/AgGrid.react.js +++ b/src/lib/fragments/AgGrid.react.js @@ -650,7 +650,7 @@ export default class DashAgGrid extends Component { updateColumnState, } = this.props; - if (this.state.gridApi && prevProps.loading_state.is_loading) { + if (this.state.gridApi) { if ( this.props.columnState !== prevProps.columnState && !this.state.columnState_push @@ -767,14 +767,10 @@ export default class DashAgGrid extends Component { this.customSetProps({getDetailResponse: null}); } // Call the API to select rows unless the update was triggered by a selection made in the UI - if ( - !equals(selectedRows, prevProps.selectedRows) && - !this.selectionEventFired - ) { + if (!equals(selectedRows, prevProps.selectedRows)) { if (!this.dataUpdates) { setTimeout(() => { if (!this.dataUpdates) { - this.pauseSelections = true; this.setSelection(selectedRows); } }, 10); @@ -870,6 +866,9 @@ export default class DashAgGrid extends Component { if (!isEmpty(filterModel)) { gridApi.setFilterModel(filterModel); } + setTimeout(() => { + this.dataUpdates = false; + }, 1); } } diff --git a/tests/test_column_state.py b/tests/test_column_state.py index c771d6d8..418d6c20 100644 --- a/tests/test_column_state.py +++ b/tests/test_column_state.py @@ -84,7 +84,7 @@ alt_colState = [ { "colId": "price", - "width": 198, + "width": 199, "hide": False, "pinned": None, "sort": "asc", @@ -239,7 +239,7 @@ def loadState(n): dash_duo.find_element("#get-column-state-button").click() testState = colState.copy() - testState[1]["width"] = 198 + testState[1]["width"] = 199 until( lambda: json.dumps(testState) in dash_duo.find_element("#reset-column-state-grid-pre").text, From 8dbb0d11266b9022bfb0fa23288ec39f9a59572d Mon Sep 17 00:00:00 2001 From: BSd3v <82055130+BSd3v@users.noreply.github.com> Date: Mon, 3 Feb 2025 06:49:35 -0500 Subject: [PATCH 02/11] locking dev dash for testing adjustments --- requires-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requires-dev.txt b/requires-dev.txt index 45dd9904..cf688b25 100644 --- a/requires-dev.txt +++ b/requires-dev.txt @@ -1,4 +1,4 @@ -dash[ci,dev,testing]>=2.0 +dash[ci,dev,testing]==3.0.0rc1 dash_mantine_components==0.12.1 pyyaml>=5.0 pytest<8.1.0 From 65c701351c2c8fa903fdee09da1434c99c52ba68 Mon Sep 17 00:00:00 2001 From: BSd3v <82055130+BSd3v@users.noreply.github.com> Date: Mon, 3 Feb 2025 06:56:10 -0500 Subject: [PATCH 03/11] reverting test for variance between machines --- tests/test_column_state.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_column_state.py b/tests/test_column_state.py index 418d6c20..c771d6d8 100644 --- a/tests/test_column_state.py +++ b/tests/test_column_state.py @@ -84,7 +84,7 @@ alt_colState = [ { "colId": "price", - "width": 199, + "width": 198, "hide": False, "pinned": None, "sort": "asc", @@ -239,7 +239,7 @@ def loadState(n): dash_duo.find_element("#get-column-state-button").click() testState = colState.copy() - testState[1]["width"] = 199 + testState[1]["width"] = 198 until( lambda: json.dumps(testState) in dash_duo.find_element("#reset-column-state-grid-pre").text, From 6b085ed3ff2d833643cd136c57708b4dc7e5b5e3 Mon Sep 17 00:00:00 2001 From: BSd3v <82055130+BSd3v@users.noreply.github.com> Date: Mon, 3 Feb 2025 07:07:07 -0500 Subject: [PATCH 04/11] updating changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bbcced94..43b7dc02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ Links "DE#nnn" prior to version 2.0 point to the Dash Enterprise closed-source D ### Fixed - [#346](https://github.com/plotly/dash-ag-grid/pull/346) Fixes issue [#347](https://github.com/plotly/dash-ag-grid/issues/347) where styling wasnt considering if the grid had rows without `data`. This is related to the alteration in [#332](https://github.com/plotly/dash-ag-grid/pull/332) - + - [#353](https://github.com/plotly/dash-ag-grid/pull/353) Adjustments for support of Dash 3 ## [31.3.0] - 2024-11-22 From 516686c27f6085f873acfc46870a0506daf5233f Mon Sep 17 00:00:00 2001 From: BSd3v <82055130+BSd3v@users.noreply.github.com> Date: Mon, 3 Feb 2025 07:14:18 -0500 Subject: [PATCH 05/11] readds support for Dash 2 --- src/lib/fragments/AgGrid.react.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/lib/fragments/AgGrid.react.js b/src/lib/fragments/AgGrid.react.js index 4a190af6..ba8fe4ff 100644 --- a/src/lib/fragments/AgGrid.react.js +++ b/src/lib/fragments/AgGrid.react.js @@ -648,9 +648,13 @@ export default class DashAgGrid extends Component { scrollTo, rowTransaction, updateColumnState, + loading_state, } = this.props; - if (this.state.gridApi) { + if ( + this.state.gridApi && + (!loading_state || prevProps.loading_state?.is_loading) + ) { if ( this.props.columnState !== prevProps.columnState && !this.state.columnState_push @@ -767,7 +771,10 @@ export default class DashAgGrid extends Component { this.customSetProps({getDetailResponse: null}); } // Call the API to select rows unless the update was triggered by a selection made in the UI - if (!equals(selectedRows, prevProps.selectedRows)) { + if ( + !equals(selectedRows, prevProps.selectedRows) && + !(!loading_state || this.selectionEventFired) + ) { if (!this.dataUpdates) { setTimeout(() => { if (!this.dataUpdates) { From a094572ad455140a0875a380360d9fdcbde76dc0 Mon Sep 17 00:00:00 2001 From: BSd3v <82055130+BSd3v@users.noreply.github.com> Date: Mon, 3 Feb 2025 11:14:59 -0500 Subject: [PATCH 06/11] adjustments for suporting dash 2 and 3 --- src/lib/fragments/AgGrid.react.js | 2 +- tests/test_sizing_buttons.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/fragments/AgGrid.react.js b/src/lib/fragments/AgGrid.react.js index ba8fe4ff..dd1adad3 100644 --- a/src/lib/fragments/AgGrid.react.js +++ b/src/lib/fragments/AgGrid.react.js @@ -773,7 +773,7 @@ export default class DashAgGrid extends Component { // Call the API to select rows unless the update was triggered by a selection made in the UI if ( !equals(selectedRows, prevProps.selectedRows) && - !(!loading_state || this.selectionEventFired) + !(loading_state && this.selectionEventFired) ) { if (!this.dataUpdates) { setTimeout(() => { diff --git a/tests/test_sizing_buttons.py b/tests/test_sizing_buttons.py index 5e421251..4737c560 100644 --- a/tests/test_sizing_buttons.py +++ b/tests/test_sizing_buttons.py @@ -457,3 +457,4 @@ def selected(state): oldValue = dash_duo.find_element("#columnState").text dash_duo.driver.set_window_size(1000, 1000) + time.sleep(.2) From 40caa85872f2ea932e98baac89603b55ba7581d6 Mon Sep 17 00:00:00 2001 From: BSd3v <82055130+BSd3v@users.noreply.github.com> Date: Mon, 3 Feb 2025 11:24:21 -0500 Subject: [PATCH 07/11] adds workflow test for dash 2 --- .github/workflows/python-test.yml | 51 +++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml index 6d56e4d6..c555a98c 100644 --- a/.github/workflows/python-test.yml +++ b/.github/workflows/python-test.yml @@ -62,6 +62,57 @@ jobs: source .venv/bin/activate pytest --headless + test-dash2: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.12"] + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + + - name: 'Setup Chrome and chromedriver' + uses: nanasess/setup-chromedriver@v2 + - name: 'Setup chromedriver environment' + run: | + export DISPLAY=:99 + chromedriver --url-base=/wd/hub & + - name: Start XVFB + run: Xvfb :99 & + + - name: Setup uv + run: | + curl -LsSf https://astral.sh/uv/install.sh | sh + uv venv + + - name: Install dependencies + run: | + source .venv/bin/activate + uv pip install --upgrade pip + uv pip install wheel + uv pip install ".[dev]" + uv pip install dash<3 + - name: Build package + run: | + source .venv/bin/activate + npm ci + npm i + npm run build + timeout-minutes: 20 + + - name: Lint + run: npm run lint + + - name: Run tests + run: | + source .venv/bin/activate + pytest --headless + test-react: runs-on: ubuntu-latest strategy: From 182843c793778fbd8c23b0578dd753edac169666 Mon Sep 17 00:00:00 2001 From: BSd3v <82055130+BSd3v@users.noreply.github.com> Date: Mon, 3 Feb 2025 11:48:58 -0500 Subject: [PATCH 08/11] reverting the locking version of dash --- requires-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requires-dev.txt b/requires-dev.txt index cf688b25..45dd9904 100644 --- a/requires-dev.txt +++ b/requires-dev.txt @@ -1,4 +1,4 @@ -dash[ci,dev,testing]==3.0.0rc1 +dash[ci,dev,testing]>=2.0 dash_mantine_components==0.12.1 pyyaml>=5.0 pytest<8.1.0 From 9e9f56d605180e8f22eea4ce9ddfbdcf37347e52 Mon Sep 17 00:00:00 2001 From: BSd3v <82055130+BSd3v@users.noreply.github.com> Date: Mon, 3 Feb 2025 11:53:19 -0500 Subject: [PATCH 09/11] fixing yml file --- .github/workflows/python-test.yml | 100 +++++++++++++++--------------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml index c555a98c..5b89a69e 100644 --- a/.github/workflows/python-test.yml +++ b/.github/workflows/python-test.yml @@ -62,56 +62,56 @@ jobs: source .venv/bin/activate pytest --headless - test-dash2: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.12"] - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - - - name: 'Setup Chrome and chromedriver' - uses: nanasess/setup-chromedriver@v2 - - name: 'Setup chromedriver environment' - run: | - export DISPLAY=:99 - chromedriver --url-base=/wd/hub & - - name: Start XVFB - run: Xvfb :99 & - - - name: Setup uv - run: | - curl -LsSf https://astral.sh/uv/install.sh | sh - uv venv - - - name: Install dependencies - run: | - source .venv/bin/activate - uv pip install --upgrade pip - uv pip install wheel - uv pip install ".[dev]" - uv pip install dash<3 - - name: Build package - run: | - source .venv/bin/activate - npm ci - npm i - npm run build - timeout-minutes: 20 - - - name: Lint - run: npm run lint - - - name: Run tests - run: | - source .venv/bin/activate - pytest --headless + test-dash2: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.12"] + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + + - name: 'Setup Chrome and chromedriver' + uses: nanasess/setup-chromedriver@v2 + - name: 'Setup chromedriver environment' + run: | + export DISPLAY=:99 + chromedriver --url-base=/wd/hub & + - name: Start XVFB + run: Xvfb :99 & + + - name: Setup uv + run: | + curl -LsSf https://astral.sh/uv/install.sh | sh + uv venv + + - name: Install dependencies + run: | + source .venv/bin/activate + uv pip install --upgrade pip + uv pip install wheel + uv pip install ".[dev]" + uv pip install dash<3 + - name: Build package + run: | + source .venv/bin/activate + npm ci + npm i + npm run build + timeout-minutes: 20 + + - name: Lint + run: npm run lint + + - name: Run tests + run: | + source .venv/bin/activate + pytest --headless test-react: runs-on: ubuntu-latest From 107cfdfd31dc583af395b5c16f1ae989f0888c9a Mon Sep 17 00:00:00 2001 From: BSd3v <82055130+BSd3v@users.noreply.github.com> Date: Mon, 3 Feb 2025 12:13:43 -0500 Subject: [PATCH 10/11] swapping dash install order --- .github/workflows/python-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml index 5b89a69e..704b0ecf 100644 --- a/.github/workflows/python-test.yml +++ b/.github/workflows/python-test.yml @@ -95,8 +95,8 @@ jobs: source .venv/bin/activate uv pip install --upgrade pip uv pip install wheel - uv pip install ".[dev]" uv pip install dash<3 + uv pip install ".[dev]" - name: Build package run: | source .venv/bin/activate @@ -154,5 +154,5 @@ jobs: - name: Run tests run: | source .venv/bin/activate - pytest --headless -k "not test_versioning" + pytest --headless From 7e42b9e9cfd598cd8130c30ed9f7dae3db421966 Mon Sep 17 00:00:00 2001 From: BSd3v <82055130+BSd3v@users.noreply.github.com> Date: Mon, 3 Feb 2025 12:39:59 -0500 Subject: [PATCH 11/11] removing explicit dash 2 test --- .github/workflows/python-test.yml | 51 ------------------------------- 1 file changed, 51 deletions(-) diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml index 704b0ecf..68cbb152 100644 --- a/.github/workflows/python-test.yml +++ b/.github/workflows/python-test.yml @@ -62,57 +62,6 @@ jobs: source .venv/bin/activate pytest --headless - test-dash2: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.12"] - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - - - name: 'Setup Chrome and chromedriver' - uses: nanasess/setup-chromedriver@v2 - - name: 'Setup chromedriver environment' - run: | - export DISPLAY=:99 - chromedriver --url-base=/wd/hub & - - name: Start XVFB - run: Xvfb :99 & - - - name: Setup uv - run: | - curl -LsSf https://astral.sh/uv/install.sh | sh - uv venv - - - name: Install dependencies - run: | - source .venv/bin/activate - uv pip install --upgrade pip - uv pip install wheel - uv pip install dash<3 - uv pip install ".[dev]" - - name: Build package - run: | - source .venv/bin/activate - npm ci - npm i - npm run build - timeout-minutes: 20 - - - name: Lint - run: npm run lint - - - name: Run tests - run: | - source .venv/bin/activate - pytest --headless - test-react: runs-on: ubuntu-latest strategy: