openculinary / frontend

The RecipeRadar Frontend is a recipe search and meal planning application
GNU Affero General Public License v3.0
13 stars 2 forks source link

Attempt to simplify scroll-to-results logic in the application #218

Closed jayaddison closed 1 year ago

jayaddison commented 1 year ago

Describe the reason for these changes and the problem that they solve

When the application loads recipes for display -- whether an individual item from local cache, or a set of results from the API -- we generally want to scroll the viewpoint so that the top result is displayed to the user.

The logic to perform this is a bit fragmented at the moment; it relates in some ways to navigation state, in some ways to bootstrap-table, and in some ways to the different logic that the application contains for each view (tab). It is partially but not completely abstracted by the shared recipe-list view component.

This changeset removes some likely-faulty old logic related to page state discovered during #217.

The changeset also attempts to simplify the intended logic by invoking the scroll event directly.

Briefly summarize the changes

  1. Update pseudo-results responses (local-authority, empty fallback) to match the current API authority response format
  2. Add a scrollToResults call to the load-successful event handler for the recipe search results list component
  3. Emit load-successful events instead of page-change events when 'local' (non-fetched) recipe results are loaded

How have the changes been tested?

  1. Browser-based testing; not thorough, and not ideal

List any issues that this change relates to Discovered during #217.