fix: 2855 Scenario Selector Filter Custom Property#2875
Open
hash471 wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this? (Check all that apply)
Description
Fixes two bugs in the Scenario Selector component:
1. Filtering by custom properties returns no results
In
_invoke_action()(taipy/gui_core/_adapters.py), custom scenario properties (type"any") were read usingattrgetter(col)(ent), which looks for a class attribute. Custom properties live inent.properties["key"], not as top-level attributes, so this raisedAttributeError— caught by the genericexcept, which returnedFalseand silently filtered out every scenario.Additionally, the early-exit guard had an operator precedence bug:
not A and not B or not Cwas parsed as(not A and not B) or (not C)instead of the intended(not A and not B) or (not C)grouping with explicit parentheses.Fix: when
col_type == "any", read the value viaent.properties.get(col)instead ofattrgetter(col)(ent), and add parentheses to the guard condition.2.
on_creationcallback receives a stale dateIn
ScenarioSelector.tsx, theemptyScenarioconstant was a module-level object whosedatefield was set tonew Date().toISOString()once at import time. Every new scenario dialog reused that frozen timestamp.Fix: replace the static constant with a
getEmptyScenario()factory function that produces a fresh date on each call.Related Tickets & Documents
How to reproduce the issue
Bug 1 — Custom property filter:
another_key = "another_value")filter=["another_key", "Label"]Bug 2 — Stale date:
on_creationpayloadBackporting
This change should be backported to:
Checklist
We encourage keeping the code coverage percentage at 80% or above.
If not, explain why:
If not, explain why: These are internal logic bugs (Python filter function + JS constant). Unit tests cover the fix; e2e would require Playwright browser automation for the filter UI which is out of scope for this fix.
If not, explain why: Bug fix only — no API or behavior change that requires documentation updates.
If not, explain why: Bug fix to be included in the next release changelog.