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

Release v1.1.2 #1584

Merged
merged 3 commits into from
Sep 28, 2023
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [v1.1.2](https://github.com/ral-facilities/datagateway/tree/v1.1.2) (2023-09-28)

[Full Changelog](https://github.com/ral-facilities/datagateway/compare/v1.1.1...v1.1.2)

**Fixed bugs:**

- \#1582 - Fix double requests on default sort [\#1583](https://github.com/ral-facilities/datagateway/pull/1583) ([kaperoo](https://github.com/kaperoo))

## [v1.1.1](https://github.com/ral-facilities/datagateway/tree/v1.1.1) (2022-08-24)

[Full Changelog](https://github.com/ral-facilities/datagateway/compare/v1.1.0...v1.1.1)
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"packages": [
"packages/*"
],
"version": "1.1.1",
"version": "1.1.2",
"npmClient": "yarn",
"useWorkspaces": true
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "datagateway",
"private": true,
"version": "1.1.0",
"version": "1.1.2",
"workspaces": [
"packages/*"
],
Expand All @@ -24,4 +24,4 @@
"postinstall": "husky install"
},
"dependencies": {}
}
}
2 changes: 1 addition & 1 deletion packages/datagateway-common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "datagateway-common",
"version": "1.1.1",
"version": "1.1.2",
"private": true,
"files": [
"lib"
Expand Down
8 changes: 6 additions & 2 deletions packages/datagateway-common/src/api/datafiles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ const fetchDatafiles = (
};

export const useDatafilesPaginated = (
additionalFilters?: AdditionalFilters
additionalFilters?: AdditionalFilters,
isMounted?: boolean
): UseQueryResult<Datafile[], AxiosError> => {
const apiUrl = useSelector((state: StateType) => state.dgcommon.urls.apiUrl);
const location = useLocation();
Expand Down Expand Up @@ -96,12 +97,14 @@ export const useDatafilesPaginated = (
handleICATError(error);
},
retry: retryICATErrors,
enabled: isMounted ?? true,
}
);
};

export const useDatafilesInfinite = (
additionalFilters?: AdditionalFilters
additionalFilters?: AdditionalFilters,
isMounted?: boolean
): UseInfiniteQueryResult<Datafile[], AxiosError> => {
const apiUrl = useSelector((state: StateType) => state.dgcommon.urls.apiUrl);
const location = useLocation();
Expand Down Expand Up @@ -129,6 +132,7 @@ export const useDatafilesInfinite = (
handleICATError(error);
},
retry: retryICATErrors,
enabled: isMounted ?? true,
}
);
};
Expand Down
8 changes: 6 additions & 2 deletions packages/datagateway-common/src/api/datasets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ export const useDataset = (
};

export const useDatasetsPaginated = (
additionalFilters?: AdditionalFilters
additionalFilters?: AdditionalFilters,
isMounted?: boolean
): UseQueryResult<Dataset[], AxiosError> => {
const apiUrl = useSelector((state: StateType) => state.dgcommon.urls.apiUrl);
const location = useLocation();
Expand Down Expand Up @@ -135,12 +136,14 @@ export const useDatasetsPaginated = (
handleICATError(error);
},
retry: retryICATErrors,
enabled: isMounted ?? true,
}
);
};

export const useDatasetsInfinite = (
additionalFilters?: AdditionalFilters
additionalFilters?: AdditionalFilters,
isMounted?: boolean
): UseInfiniteQueryResult<Dataset[], AxiosError> => {
const apiUrl = useSelector((state: StateType) => state.dgcommon.urls.apiUrl);
const location = useLocation();
Expand Down Expand Up @@ -168,6 +171,7 @@ export const useDatasetsInfinite = (
handleICATError(error);
},
retry: retryICATErrors,
enabled: isMounted ?? true,
}
);
};
Expand Down
8 changes: 6 additions & 2 deletions packages/datagateway-common/src/api/facilityCycles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ export const useFacilityCyclesByInvestigation = (
};

export const useFacilityCyclesPaginated = (
instrumentId: number
instrumentId: number,
isMounted?: boolean
): UseQueryResult<FacilityCycle[], AxiosError> => {
const apiUrl = useSelector((state: StateType) => state.dgcommon.urls.apiUrl);
const location = useLocation();
Expand Down Expand Up @@ -171,12 +172,14 @@ export const useFacilityCyclesPaginated = (
handleICATError(error);
},
retry: retryICATErrors,
enabled: isMounted ?? true,
}
);
};

export const useFacilityCyclesInfinite = (
instrumentId: number
instrumentId: number,
isMounted?: boolean
): UseInfiniteQueryResult<FacilityCycle[], AxiosError> => {
const apiUrl = useSelector((state: StateType) => state.dgcommon.urls.apiUrl);
const location = useLocation();
Expand Down Expand Up @@ -204,6 +207,7 @@ export const useFacilityCyclesInfinite = (
handleICATError(error);
},
retry: retryICATErrors,
enabled: isMounted ?? true,
}
);
};
Expand Down
8 changes: 6 additions & 2 deletions packages/datagateway-common/src/api/instruments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ const fetchInstruments = (
};

export const useInstrumentsPaginated = (
additionalFilters?: AdditionalFilters
additionalFilters?: AdditionalFilters,
isMounted?: boolean
): UseQueryResult<Instrument[], AxiosError> => {
const apiUrl = useSelector((state: StateType) => state.dgcommon.urls.apiUrl);
const location = useLocation();
Expand Down Expand Up @@ -91,12 +92,14 @@ export const useInstrumentsPaginated = (
handleICATError(error);
},
retry: retryICATErrors,
enabled: isMounted ?? true,
}
);
};

export const useInstrumentsInfinite = (
additionalFilters?: AdditionalFilters
additionalFilters?: AdditionalFilters,
isMounted?: boolean
): UseInfiniteQueryResult<Instrument[], AxiosError> => {
const apiUrl = useSelector((state: StateType) => state.dgcommon.urls.apiUrl);
const location = useLocation();
Expand Down Expand Up @@ -124,6 +127,7 @@ export const useInstrumentsInfinite = (
handleICATError(error);
},
retry: retryICATErrors,
enabled: isMounted ?? true,
}
);
};
Expand Down
16 changes: 12 additions & 4 deletions packages/datagateway-common/src/api/investigations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ export const useInvestigation = (

export const useInvestigationsPaginated = (
additionalFilters?: AdditionalFilters,
ignoreIDSort?: boolean
ignoreIDSort?: boolean,
isMounted?: boolean
): UseQueryResult<Investigation[], AxiosError> => {
const apiUrl = useSelector((state: StateType) => state.dgcommon.urls.apiUrl);
const location = useLocation();
Expand Down Expand Up @@ -145,13 +146,15 @@ export const useInvestigationsPaginated = (
handleICATError(error);
},
retry: retryICATErrors,
enabled: isMounted ?? true,
}
);
};

export const useInvestigationsInfinite = (
additionalFilters?: AdditionalFilters,
ignoreIDSort?: boolean
ignoreIDSort?: boolean,
isMounted?: boolean
): UseInfiniteQueryResult<Investigation[], AxiosError> => {
const apiUrl = useSelector((state: StateType) => state.dgcommon.urls.apiUrl);
const location = useLocation();
Expand Down Expand Up @@ -185,6 +188,7 @@ export const useInvestigationsInfinite = (
handleICATError(error);
},
retry: retryICATErrors,
enabled: isMounted ?? true,
}
);
};
Expand Down Expand Up @@ -558,7 +562,8 @@ const fetchISISInvestigations = (
export const useISISInvestigationsPaginated = (
instrumentId: number,
instrumentChildId: number,
studyHierarchy: boolean
studyHierarchy: boolean,
isMounted?: boolean
): UseQueryResult<Investigation[], AxiosError> => {
const apiUrl = useSelector((state: StateType) => state.dgcommon.urls.apiUrl);
const location = useLocation();
Expand Down Expand Up @@ -652,14 +657,16 @@ export const useISISInvestigationsPaginated = (
handleICATError(error);
},
retry: retryICATErrors,
enabled: isMounted ?? true,
}
);
};

export const useISISInvestigationsInfinite = (
instrumentId: number,
instrumentChildId: number,
studyHierarchy: boolean
studyHierarchy: boolean,
isMounted?: boolean
): UseInfiniteQueryResult<Investigation[], AxiosError> => {
const apiUrl = useSelector((state: StateType) => state.dgcommon.urls.apiUrl);
const location = useLocation();
Expand Down Expand Up @@ -730,6 +737,7 @@ export const useISISInvestigationsInfinite = (
handleICATError(error);
},
retry: retryICATErrors,
enabled: isMounted ?? true,
}
);
};
Expand Down
8 changes: 6 additions & 2 deletions packages/datagateway-common/src/api/studies.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ const fetchStudies = (
};

export const useStudiesPaginated = (
additionalFilters?: AdditionalFilters
additionalFilters?: AdditionalFilters,
isMounted?: boolean
): UseQueryResult<Study[], AxiosError> => {
const apiUrl = useSelector((state: StateType) => state.dgcommon.urls.apiUrl);
const location = useLocation();
Expand Down Expand Up @@ -94,12 +95,14 @@ export const useStudiesPaginated = (
handleICATError(error);
},
retry: retryICATErrors,
enabled: isMounted ?? true,
}
);
};

export const useStudiesInfinite = (
additionalFilters?: AdditionalFilters
additionalFilters?: AdditionalFilters,
isMounted?: boolean
): UseInfiniteQueryResult<Study[], AxiosError> => {
const apiUrl = useSelector((state: StateType) => state.dgcommon.urls.apiUrl);
const location = useLocation();
Expand Down Expand Up @@ -127,6 +130,7 @@ export const useStudiesInfinite = (
handleICATError(error);
},
retry: retryICATErrors,
enabled: isMounted ?? true,
}
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@ describe('ISIS - Instruments Cards', () => {
.first()
.contains('With piece reason late model.');

cy.contains('[role="button"]', 'Name')
.click()
.wait('@getInstrumentsOrder', { timeout: 10000 });
cy.contains('[role="button"]', 'Name').click();
cy.contains('[role="button"]', 'asc').should('not.exist');
cy.contains('[role="button"]', 'desc').should('not.exist');
cy.get('[data-testid="card"]')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,7 @@ describe('ISIS - Studies Cards', () => {
cy.contains('[role="button"]', 'desc').should('exist');
cy.get('[data-testid="card"]').first().contains('STUDY 314');

cy.contains('[role="button"]', 'Start Date')
.click()
.wait('@getStudiesOrder', {
timeout: 10000,
});
cy.contains('[role="button"]', 'Start Date').click();
cy.contains('[role="button"]', 'asc').should('not.exist');
cy.contains('[role="button"]', 'desc').should('not.exist');
cy.get('[data-testid="card"]').first().contains('STUDY 4');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe('ISIS - Datasets Table', () => {
cy.login();
cy.visit(
'/browse/instrument/1/facilityCycle/16/investigation/97/dataset'
).wait(['@datasetsCount', '@datasetsOrder', '@datasetsOrder'], {
).wait(['@datasetsCount', '@datasetsOrder'], {
timeout: 10000,
});
// Check that we have received the size from the API as this will produce
Expand Down
4 changes: 2 additions & 2 deletions packages/datagateway-dataview/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "datagateway-dataview",
"version": "1.1.1",
"version": "1.1.2",
"private": true,
"dependencies": {
"@material-ui/core": "^4.11.3",
Expand All @@ -14,7 +14,7 @@
"axios": "^0.26.0",
"connected-react-router": "^6.9.1",
"custom-event-polyfill": "^1.0.7",
"datagateway-common": "^1.1.1",
"datagateway-common": "^1.1.2",
"date-fns": "^2.28.0",
"history": "^4.10.1",
"i18next": "^21.6.13",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,17 @@ describe('DLS Datasets - Card View', () => {
}),
},
]);
expect(useDatasetsPaginated).toHaveBeenCalledWith([
{
filterType: 'where',
filterValue: JSON.stringify({
'investigation.id': { eq: investigationId },
}),
},
]);
expect(useDatasetsPaginated).toHaveBeenCalledWith(
[
{
filterType: 'where',
filterValue: JSON.stringify({
'investigation.id': { eq: investigationId },
}),
},
],
expect.any(Boolean)
);
});

it('updates filter query params on text filter', () => {
Expand Down Expand Up @@ -170,6 +173,14 @@ describe('DLS Datasets - Card View', () => {
expect(history.location.search).toBe(
`?sort=${encodeURIComponent('{"createTime":"desc"}')}`
);

// check that the data request is sent only once after mounting
expect(useDatasetsPaginated).toHaveBeenCalledTimes(2);
expect(useDatasetsPaginated).toHaveBeenCalledWith(expect.anything(), false);
expect(useDatasetsPaginated).toHaveBeenLastCalledWith(
expect.anything(),
true
);
});

it('updates sort query params on sort', () => {
Expand Down
Loading