progenetix/progenetix-web

Error: Positional queries with start == 1 remove parameter

Closed this issue · 2 comments

If the start value is set to 1 it is being removed during query creation. This may be due to start = start -1 (transformation from 1-base interface to 0-based query parameter), and then the 0 being treated as missing value during query generation. However, the form value of start: 1 should translate into &start=0.

@ptoussai I've fixed this by casting the (first) start value to string. This is the only one that possibly would convert to 0:

  if (start) {
    const match = INTEGER_RANGE_REGEX.exec(start)
    if (!match) throw new Error("incorrect start range")
    const [, start0, start1] = match
    var s0 = start0 - 1
    s0 = s0.toString()
    starts.push( s0 )
    start1 && starts.push( start1 )
  }

... closing this since seems fixed (though maybe better solutions possible?).