Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#14525 was not enough to fix the internal ref issue.
Long story short, #14525 fixed the image picture cache that is built from the
cards
data returned by theload_column_state
ajax request.However, the
cards
entry returned in this request do not contain all displayed cards, it only contains cards that where moved in the kanban (thus saving their custom positions).This mean that we may have 0 cards returned by this request, which make our cache far less useful.
To fix this specific point and improve the overall performances, I've applied the following fixes:
1) Use user picture placeholder, load real pictures later
The kanban code is already able to display a fallback picture with the
generateUserBadge
function.I've forced all users pictures to be displayed using this fallback method as a placeholder and kept track of their users id is a set.
After the kanban is fully displayed, I load the real images with a single ajax request and replace the placeholders.
This is similar to what the cache was doing but is done after the kanban is fully loaded (instead of before).
This mean we are sure to know all the users pictures that must be loaded and we wont impact the main loading process.
2) Use
POST
requestsAs we use a single query to load all the pictures, it could be possible to exceed the max
GET
size if too much users_id are specified.Using a
POST
request avoid this potential issue.3) Remove the cache preload step
With this new system, we don't really need the cache preload step anymore so we can save a request by deleting it.
4) Remove synchronous requests
I've removed the last remaining call to
$.ajax
which usedasync: false
to avoid blocking the main thread.I've replaced it by
async
/await
and tried to group the columns loading requests into a singleawait Promise.all
to allow them to be executed concurrently.