Fix frequent items timestamps not updated
What does this MR do?
The original frequent items app shimmyed this lastAccessedOn
into the currentItem
object. The new top nav neglected to do this, which kept the items in local storage from updating.
PLEASE NOTE: There's still a number of issues with handling this in localStorage
which should be holistically resolved soon when we change this to "Recently visited projects".
Screenshots (strongly suggested)
The following test cases assume you are logged into the root
user and visiting the default GitLab Test
project with id: 1
.
lastAccessedOn
Case 1 - Item exists without How to set up? Run the following in the browser console:
localStorage.setItem('root/frequent-projects', JSON.stringify([{ id: 1, name: "Gitlab Test", namespace: "Gitlab Org / Gitlab Test", webUrl: "/gitlab-org/gitlab-test", frequency: 2 }]))
What to expect? After visiting the project page, the frequency
should be bumped forcing it to pass the threshold and showing it in the dropdown.
Not visiting project (not enough frequency to show) | After visiting project (frequency is updated) |
---|---|
![]() |
![]() |
lastAccessedOn
Case 2 - Item exists with very recent How to set up? Run the following in the browser console:
localStorage.setItem('root/frequent-projects', JSON.stringify([{ id: 1, name: "Gitlab Test", namespace: "Gitlab Org / Gitlab Test", webUrl: "/gitlab-org/gitlab-test", frequency: 2, lastAccessedOn: Date.now() }]))
What to expect? After visiting the project page, the frequency
should not be updated. You can verify this by inspecting the local storage.
Not visiting project (not enough frequency to show) | After visiting project (frequency is not updated) |
---|---|
![]() |
![]() |
Does this MR meet the acceptance criteria?
Conformity
-
I have included changelog trailers, or none are needed. (Does this MR need a changelog?) -
I have added/updated documentation, or it's not needed. (Is documentation required?) -
I have properly separated EE content from FOSS, or this MR is FOSS only. (Where should EE code go?) -
I have added information for database reviewers in the MR description, or it's not needed. (Does this MR have database related changes?) -
I have self-reviewed this MR per code review guidelines. -
This MR does not harm performance, or I have asked a reviewer to help assess the performance impact. (Merge request performance guidelines) -
I have followed the style guides. -
This change is backwards compatible across updates, or this does not apply.
Availability and Testing
-
I have added/updated tests following the Testing Guide, or it's not needed. (Consider all test levels. See the Test Planning Process.) -
I have tested this MR in all supported browsers, or it's not needed.