Repository navigation
Conversation
|
Thanks for your contribution! Please DO NOT commit the files in dist, i18n, and ssr/client/dist folders in a non-release pull request. These folders are for release use only. |
This branch has not been deployed
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.
Brief Information
This pull request is in the type of:
What does this PR do?
Keep all matching dataset rows when a
regfilter uses a global or sticky regular expression, with stable results on repeated updates.Fixed issues
No linked issue. Reproduction and regression coverage are included below.
Details
Before: What was the problem?
A normal filter using
/alpha/gidrops repeated matching rows:All three values match the configured condition, but the series receives only two rows. The regression reproduces this through
setOption, using the repository's normal Jest/jsdom test setup.The source-module CLI reproduction also runs the normal
createSource->applyDataTransform-> built-in filter path. Starting with a fresh regexp whoselastIndexis zero, the first computation retainsfirstandthird; recomputing the same configuration retains onlysecond.gandypatterns show the same issue. A mixed positive/negative dataset also loses a matching row, while a stateless regexp or string condition produces stable correct results.The transform configuration clone retains
RegExpreferences.RegExpEvaluatorthen shares the caller's regexp and itslastIndexacross rows, so later records depend on previous matches. This conflicts with the documented filter behavior of selecting matching items;regsupports RegExp or string conditions.After: How does it behave after the fixing?
Create an evaluator-owned regexp and reset its cursor before testing each value. The pattern and flags are preserved, including ignore-case, multiline, and sticky positioning. Duplicate matching records are all retained in order, repeated computations are stable, and the caller's original regexp cursor remains unchanged.
The regexp is cloned once when the condition is parsed, rather than once per row. No new comparator API, dependency, or configuration is introduced. This is independent of #21828: its missing-value type guard is not included here, and the reproduction uses ordinary strings.
Document Info
Misc
Security Checking
ZRender Changes
Related test cases or examples to use the new APIs
Added 21 regression/control tests through actual data transforms, including one through
setOptionand resulting series data. On the unchanged base, 17 fail and 4 pass; after the fix, all 21 pass.Coverage includes array/object rows, repeated computations with
g/gi/y/iy, a caller-owned nonzero cursor, ignore-case/multiline flags, sticky anchoring, matching and nonmatching rows, row order, logical/piped filters, ordinary regexp and string controls, and successivesetOptioncalls. No comparator/classifier is mocked.The CLI source-module output confirms stable row IDs before/after recomputation. Node 24.22.1, TypeScript 4.4.3, Jest 26.6.3, and zrender 6.1.0 were used. The existing local full-project typecheck limitation from incompatible installed ambient dependency declarations remains; no full-project typecheck success is claimed. No dependency/configuration changes are included. Real-browser rendering is unverified; Jest/jsdom/canvas mocks are used for the API data assertions.
Merging options
Other information
OpenAI Codex assisted with the unchanged-source reproduction, narrow implementation, tests, and verification described above.