Opened 5 years ago

Closed 4 years ago

#18334 closed defect (patchwelcome)

FilteringSelect query logic includes multi-line matching for empy strings

Reported by: rmaccracken Owned by:
Priority: undecided Milestone: 1.13
Component: Dijit - Form Version: 1.10.2
Keywords: Cc:
Blocked By: Blocking:

Description

We found a strange defect in our app which we eventually narrowed down to one of our objects have a name that contained newline characters such that one of the lines was empty.

For example, the value was something like: "Hello

World"

Now, when we reset the FilteringSelect? control, the displayed value goes to an empty string and in _setDisplayedValueAttr it does a store query for items that exactly match an empty string. When composing the query, it calls _patternToRegExp in SearchMixin? which essentially creates the following regular expression:

new RegExp?("^$","m")

The "m" modifier was new to me, so I looked it up and found that it adds multi-line matching. So what that means now is any string that contains an empty line will match this. In my case, there was only one, so the value of the FilteringSelect? was set to this one object's id rather than resetting to essentially have no value.

I don't think this should be the desired behavior. Maybe multi-line matching makes sense when the query string is non-empty, but I don't think the empty string case should trigger multi-line matching.

Change History (1)

comment:1 Changed 4 years ago by dylan

Milestone: tbd1.12
Resolution: patchwelcome
Status: newclosed

I'm not sure that there's a good answer here. ES6 template strings certainly make this all a lot easier. I'm inclined to mark as patchwelcome, as I don't think this is going to change without someone spending the time to think through all possible scenarios and writing a solid range of tests to cover all cases.

Note: See TracTickets for help on using tickets.