traccar / traccar-web

Traccar GPS Tracking System
https://www.traccar.org
Apache License 2.0
814 stars 1.13k forks source link

Select fields are not pre-populated #1196

Closed TheZoker closed 10 months ago

TheZoker commented 10 months ago

Describe the bug When I change the input of a select field and reload the page, there is no value in the field. When I click on it to select another value, it shows the selected value. I created a screencast of the issue.

To Reproduce Steps to reproduce the behavior:

  1. Go to Devices
  2. Click on the Connections icon
  3. Select a value for any of the fields
  4. Reload the page

Expected behavior

Show values on page load

Screenshots

https://github.com/traccar/traccar-web/assets/1368405/6a9bd3d4-06cd-493d-bfb6-95ae4b0d9eee

Desktop (please complete the following information):

tananaev commented 10 months ago

This is expected to avoid making large number of API calls too early.

TheZoker commented 10 months ago

IMHO this is very confusing for the user, since he never knows which fields have values and which do not.

Maybe make delayed calls?

tananaev commented 10 months ago

How would delayed calls solve the problem?

TheZoker commented 10 months ago

I'm not sure, but I also don't think I understand the problem. Other applications can handle this, this is the only app, that does not show which options are selected by the user.

I though that with this:

large number of API calls too early

you mean the API should not be jammed with a lot of calls early. If you delay them, they are not called early

Maybe a new API endpoint, which returns all the data within one call could solve this. Then there would be only one call instead of many. But I'm not expert on this topic, just a confused user.

tananaev commented 10 months ago

The problem is calling pretty expensive APIs when they don't need to be called. There are 2 API calls for each field. Most of the time people only need to change one of the fields. It doesn't make sense to call all of them preemptively.

Combining everything into one call doesn't solve any problem. The bottleneck is database requests, not number of API calls.