mistic100 / mistic100/jQuery-QueryBuilder
QueryBuilder.updateRuleFilter is deleting "user" data
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.7k
- Forks
- 544
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
we currently faced an issue were the data from our custom plugins were deleted by the querybuilder core system.
From my understanding the data associated with a rule is meant to be managed by external components like plugins and should not be deleted by the querybuilder (as long as the rule is not deleted or similar).
But I may misunderstand the intent.
The situation comes from:
In QueryBuilder.prototype.updateRuleFilter
https://github.com/mistic100/jQuery-QueryBuilder/blob/dev/src/core.js#L756
// clear rule data if the filter changed
if (previousFilter && rule.filter && previousFilter.id !== rule.filter.id) {
rule.data = undefined;
}
As far as I can tell this is the only place where the data (as "user" data) is deleted.
Maybe the intent was to clear the rule value and it was a typo ?
As a (temporary?) workaround I am overriding the updateRuleFilter prototype locally to not have this behavior.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/core.js at QueryBuilder.prototype.updateRuleFilter, especially the block that clears rule.data when the filter changes. Reproduce the behavior with custom plugin data and inspect whether rule data is intended to survive filter changes. Done means the issue's intended data-preservation behavior is confirmed and covered by an appropriate regression check.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, jquery
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100