Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dashboard: Improving the logic of detecting if a site has orders #12739

Open
Tracked by #12655
selanthiraiyan opened this issue May 15, 2024 · 1 comment
Open
Tracked by #12655
Labels
type: enhancement A request for an enhancement.

Comments

@selanthiraiyan
Copy link
Contributor

selanthiraiyan commented May 15, 2024

Quoting @hichamboushaba from an internal thread p1715164179010139-slack-C03L1NF1EA3

Problem

Currently, to detect if a site has orders or not following this (at least in Android):

  1. We check how many orders we have in the DB, and if we have a non-zero count, we decide that the site has orders.
  2. If we don’t have cached orders, we fetch the order’s count from the API.

This logic has a side effect, that for stores with orders, and before fetching the order list, we have a “flicker” in the dashboard caused by showing the “Share Store” card then hiding it after the API call (point 2), see the video for understanding what I mean.

RPReplay_Final1715164598.MP4

Solution

The new logic I suggest:

  1. Start with cached order’s count, and if it’s != 0, then use it directly.
  2. If there are no cached orders, check the cached value of order status options we get from the above endpoint, and if it’s not empty, then sum the total of all its values*.
  3. If there are no cached values, then revert to fetching the order’s count from the API using the existing logic that we use now.
@dangermattic
Copy link
Collaborator

dangermattic commented May 15, 2024

🚫 Please add a type label (e.g. type: enhancement) and a feature label (e.g. feature: stats) to this issue.

@selanthiraiyan selanthiraiyan added the type: enhancement A request for an enhancement. label May 15, 2024
@selanthiraiyan selanthiraiyan changed the title Improving the logic of detecting if a site has orders Dashboard: Improving the logic of detecting if a site has orders May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A request for an enhancement.
Projects
None yet
Development

No branches or pull requests

2 participants