ushahidi / platform-client-mzima

Other
14 stars 99 forks source link

Removing unneccessary calls when opening/editing a post #1463

Open Angamanga opened 5 days ago

Angamanga commented 5 days ago

This PR introduce a resolver instead of a guard for post-detail/post-edit view. In this way, we can still check the permissions and also reuse the post-object in the components, and in that way removing an unneccessary call to the API that slowed down the opening of the post. To test:

  1. Go to feed-view
  2. Click on a post
    • [ ] The post should open (but faster!!)
  3. Click on the pen on the post
    • [ ] The edit-view should open with the correct info (but faster!!)
  4. Test all kinds of actions, changing status, adding to collections etc etc, they should all work and be reflected in the UI
  5. Test on small screens and on the map, the modal should open and all functionality should work as before
  6. Test accessing the edit-url as a logged out user
    • [ ] You should get redirected to the "not found" url
  7. Test accessing a post under review as a logged out user
    • [ ] You should get redirected to the "not found" url

Note: While testing this, I found an existing bug in the mapview: https://linear.app/ushahidi/issue/USH-1677/changing-status-on-a-post-in-map-view-doesnt-update-the-ui-to-reflect I have not fixed that in this PR.

linear[bot] commented 5 days ago

USH-1667 Excessive API Calls and Delayed Rendering in Post View and Edit Pages