Commit 49b39610 authored by Andrew Fontaine's avatar Andrew Fontaine

Reset the page to 1 when changing tabs

If a scope doesn't have the same number of pages, users can end up in a
state where they see nothing and the page appears broken.

By moving to the first page, we ensure we load the first set of
environments, which should pretty much always exist. If the count is 0,
then the page will be empty as expected.
parent 8815c342
......@@ -145,7 +145,7 @@ export default {
},
setScope(scope) {
this.scope = scope;
this.resetPolling();
this.moveToPage(1);
},
movePage(direction) {
this.moveToPage(this.pageInfo[`${direction}Page`]);
......
......@@ -187,7 +187,7 @@ describe('~/environments/components/new_environments_app.vue', () => {
expect(environmentAppMock).toHaveBeenCalledWith(
expect.anything(),
expect.objectContaining({ scope: 'stopped' }),
expect.objectContaining({ scope: 'stopped', page: 1 }),
expect.anything(),
expect.anything(),
);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment