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

Fix: Feature usage chart pagination #1013

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jcscottiii
Copy link
Collaborator

@jcscottiii jcscottiii commented Dec 27, 2024

Background:

When backfilling usage data, the feature usage chart displayed only a few data points, not the complete set. Network inspection revealed that multiple pages of data were successfully retrieved.

Repro:

  1. Navigate to: https://website-webstatus-dev.corp.goog/features/flexbox?showUsageChart

Solution:

This change aligns the feature usage chart pagination with the feature support chart's implementation:

async _fetchFeatureSupportData(
apiClient: APIClient,
featureId: string,
startDate: Date,
endDate: Date,
) {
if (typeof apiClient !== 'object') return;
this.featureSupportChartDataObj = this.createFeatureSupportDataFromMap();
const channel = STABLE_CHANNEL;
const promises = ALL_BROWSERS.map(async browser => {
for await (const page of apiClient.getFeatureStatsByBrowserAndChannel(
featureId,
browser,
channel,
startDate,
endDate,
)) {
// Append the new data to existing data
const existingData =
this.featureSupport.get(featureSupportKey(browser, channel)) || [];
this.featureSupport.set(featureSupportKey(browser, channel), [
...existingData,
...page,
]);
this.featureSupportChartDataObj =
this.createFeatureSupportDataFromMap();
}
});

Testing:

Comprehensive unit tests will be included with the refactor outlined in #964.

To validate the pagination logic, this commit increases the number of data points displayed to over 100, enabling testing through Playwright. To optimize Playwright test performance, the initial data load specifically filters for the feature used in the feature page test, mitigating delays associated with loading excessive fake data.

Other changes

  • Add more logging to the fake data script

**Background:**

When backfilling usage data, the feature usage chart displayed only a few data points, not the complete set.  Network inspection revealed that multiple pages of data were successfully retrieved.

**Repro:**

1. Navigate to: https://website-webstatus-dev.corp.goog/features/flexbox?showUsageChart

**Solution:**

This change aligns the feature usage chart pagination with the feature support chart's implementation: https://github.com/GoogleChrome/webstatus.dev/blob/b84a9ac02c2455dd6e5043615fc2a084f6980a46/frontend/src/static/js/components/webstatus-feature-page.ts#L621-L650

**Testing:**

Comprehensive unit tests will be included with the refactor outlined in #964.

To validate the pagination logic, this commit increases the number of data points displayed to over 100, enabling testing through Playwright. To optimize Playwright test performance, the initial data load specifically filters for the feature used in the feature page test, mitigating delays associated with loading excessive fake data.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant