Skip to content

Lazy-load store menu in topbar

Jano requested to merge lazy_load_store_menu_in_topbar into master

Closes #901 (closed)

What does this MR do?

This MR

  • removes the ['betriebe'] key in the session
  • makes a user's stores available over the REST API
  • makes the top bar fetch the stores over the REST API instead of getting it from the session when the HTML is generated on server-side
  • makes the top bar menu lazy-load the stores, so they only get loaded when the user clicks on it
  • removes the global/combined pickup state, as this would require the store data to be fetched on page load

How confident are you it won't break things if deployed?

I'm quite confident, although the removal of the 'betriebe' session key might have some side effects that I didn't think of... There has been a check on the user's dashboard that I removed. Additionally to asking the session if the current user has the foodsaver role, it looked if the key 'betriebe' was defined and treated the user as a foodsaver anyway if this was the case. I don't know what that supposed to do, I removed it assuming it was not necessary.

Links to related MRs

This MR fixes what those attempted to fix: !1171 (closed) !1262 (closed)

How to test

  1. Checkout branch locally
  2. Login as foodsaver
  3. Click on the "stores" icon in the top bar and see that it lazy-loads (you should see a loading animation for a short time – if not, check in the developer tools that the request isn't done before clicking on the icon)

Checklist

  • added a test, or explain why one is not needed/possible...
  • no unrelated changes
  • asked someone for a code review
  • joined #foodsharing-beta channel at https://slackin.yunity.org
  • added an entry to CHANGELOG.md (description, merge request link, username(s))
  • Once your MR has been merged, you are responsible to update the #foodsharing-beta Slack channel about what has been changed here. They will test your work in different browsers, roles or other settings
Edited by Chris Oelmueller

Merge request reports