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

Bug Fix: handle non existent data field in paginated data #1359

Merged
merged 2 commits into from
Apr 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion e2e/tests/overview-page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
*/

import {test, expect, Request} from '@playwright/test';
import {gotoOverviewPageUrl, getOverviewPageFeatureCount} from './utils';
import {
gotoOverviewPageUrl,
getOverviewPageFeatureCount,
loginAsUser,
} from './utils';

test('matches the screenshot', async ({page}) => {
await gotoOverviewPageUrl(page, 'http://localhost:5555/');
Expand Down Expand Up @@ -258,6 +262,12 @@ test('Typing slash focuses on searchbox', async ({page}) => {
await expect(searchbox).toHaveAttribute('value', 'def/ghi');
});

test('newly logged in user should see no errors (toasts)', async ({page}) => {
await loginAsUser(page, 'fresh user');
await gotoOverviewPageUrl(page, 'http://localhost:5555/');
await expect(page.locator('.toast')).toHaveCount(0);
});

test.describe('saved searches', () => {
test('unauthenticated user can load a public saved search and navigate pages', async ({
page,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/static/js/api/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ export class APIClient {
);

nextPageToken = page?.metadata?.next_page_token;
allData.push(...page.data);
allData.push(...(page.data ?? []));
offset += (page.data || []).length;
} while (nextPageToken !== undefined);

Expand Down
5 changes: 3 additions & 2 deletions util/cmd/load_test_users/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,10 @@ func getUsers() []User {
EmailVerified: true,
UserID: "abcdedf1234567892",
},
// This user should have no data and should be used to replicate the experience of a newly logged in user.
{
Name: "test user 3",
Email: "test.user.3@example.com",
Name: "fresh user",
Email: "fresh[email protected]",
EmailVerified: true,
UserID: "abcdedf1234567893",
},
Expand Down
Loading