MiniProfiler / dotnet

A simple but effective mini-profiler for ASP.NET (and Core) websites
https://miniprofiler.com/dotnet/
MIT License
2.91k stars 599 forks source link

polling use first instead of last #653

Open erwan-joly opened 1 year ago

erwan-joly commented 1 year ago

It appears that there is an issue with the JavaScript component responsible for polling the next result on the results-index page. The page is arranged in descending order by time, with the most recent item at the top. However, the last ID used for polling is the least recent one, causing the page to continuously grow larger as it retrieves n-1 results with each polling iteration.

image

Most likely the error is here https://github.com/MiniProfiler/dotnet/blob/a009d55a19050c8b88a3ea0c357d54ad192763b5/src/MiniProfiler.Shared/ui/lib/MiniProfiler.ts#L439C57-L439C64

it should be oldData[0]

Note even with that fix we will end up with the wrong result displayed as it will display all the new results at the bottom...

that's what we currently would see with 3 items:

first load
3
2
1
polling last id=1
3
2
polling last id = 2
3
polling last id = 3
polling last id = 3
polling last id = 3

if we use oldData[0] this would work like that:

first load
3
2
1
polling last id = 3
polling last id = 3
polling last id = 3

but as soon as we get a new id 4 the polling will push it at the end and the page table will now display

3
2
1
polling last id = 3
4
axylophon commented 8 months ago

We have the same problem. I think #550 is the cause.