stable

Clone or download

Read-only

Implement a cache system to store the user history route result

Part of story #24971 [modal] search for artifacts Now, there are about 30000000000/too many calls to the route GET /users/:id/history when the artifact field is used. Since the result of the route should not change during the linking of the artifacts and because we like baby polar bears, implementing a cache system is relevant to avoid useless REST calls. How to test: - Enable the feature flag: `tuleap config-set feature_flag_history_and_search_in_modal 1` - Open the web dev console to see the REST route call - Open an artifact (with an artifact link field) in the artifact modal => There is only one call to the GET user/:id/history route (instead of 2) => The `recently viewed artifact` section is still displayed - Use the autocompleter => There is no call to the GET user/:id/history route anymore => The `recently viewed artifact` section is filtered as before Change-Id: I8bba279bbba3dec824a0bc0a21360e411a865e46

Modified Files

Name
A plugins/tracker/scripts/lib/artifact-modal/src/adapters/Memory/UserHistoryCache.test.ts +64 −0 Go to diff View file
A plugins/tracker/scripts/lib/artifact-modal/src/adapters/Memory/UserHistoryCache.ts +41 −0 Go to diff View file
M plugins/tracker/scripts/lib/artifact-modal/src/tuleap-artifact-modal-controller.js +3 −1 Go to diff View file