Skip to content

Commit

Permalink
UHF-X: Update Typescript version (#740)
Browse files Browse the repository at this point in the history
* test

* UHF-X: update typescript version

* UHF-X: fix type error and clean unused imports.

* Add react dists

* Clean tests from Card.tsx
  • Loading branch information
Jussiles authored Aug 28, 2023
1 parent 02224e1 commit 9067b6e
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 34 deletions.
2 changes: 1 addition & 1 deletion dist/js/district-and-project-search.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/job-search.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/linkedevents.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/news-archive.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/school-search.min.js

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
"svg-inline-loader": "^0.8.0",
"svg-sprite": "^2.0",
"ts-loader": "^9.4.2",
"typescript": "^4.9.4",
"typescript": "^5.1.6",
"webpack": "^5.56.2",
"webpack-cli": "^5.0.0",
"webpack-merge": "^5.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useAtomValue, useSetAtom } from 'jotai';
import { LoadingSpinner } from 'hds-react';
import { ForwardedRef, SyntheticEvent, createRef, useEffect } from 'react';
import { SyntheticEvent, createRef } from 'react';
import Global from '../enum/Global';
import URLParams from '../types/URLParams';
import { configurationsAtom, pageAtom, setPageAtom, urlAtom } from '../store';
Expand Down Expand Up @@ -44,7 +43,7 @@ const PromotedResultsContainer = () => {
if (!data && !error) {
return;
}

if (error || initializationError|| data.error) {
return (
<ResultsError
Expand All @@ -53,21 +52,21 @@ const PromotedResultsContainer = () => {
/>
);
}

const [promotedResponse, baseResponse] = data.responses;

// Typecheck and combine totals from both queries
const promotedTotal = Number(promotedResponse.aggregations?.total_count?.value);
const baseTotal = Number(baseResponse.aggregations?.total_count?.value);
const total = (Number.isNaN(promotedTotal) ? 0 : promotedTotal) + (Number.isNaN(baseTotal) ? 0 : baseTotal);

if (total <= 0) {
return <NoResults ref={scrollTarget} />;
}

const pages = Math.floor(total / size);
const addLastPage = total > size && total % size;

// Typecheck and combine job totals (aggregated vacancies)
const promotedJobs = promotedResponse.aggregations?.[IndexFields.NUMBER_OF_JOBS]?.value;
const baseJobs = baseResponse.aggregations?.[IndexFields.NUMBER_OF_JOBS]?.value;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useAtomValue, useSetAtom } from 'jotai';
import { LoadingSpinner } from 'hds-react';
import { SyntheticEvent, createRef, useEffect } from 'react';
import { SyntheticEvent, createRef } from 'react';
import URLParams from '../types/URLParams';
import { urlAtom , configurationsAtom, pageAtom, setPageAtom } from '../store';
import useQueryString from '../hooks/useQueryString';
Expand Down Expand Up @@ -38,15 +37,15 @@ const SimpleResultsContainer = () => {
if (!data && !error) {
return;
}

if (!data?.hits?.hits.length) {
return <NoResults ref={scrollTarget} />;
}

if (error || initializationError) {
return <ResultsError error={error||initializationError} ref={scrollTarget}/>;
}

const results = data.hits.hits;
const total = data.aggregations.total_count.value || data.hits.total.value;
const pages = Math.floor(total / size);
Expand Down
2 changes: 1 addition & 1 deletion src/js/react/apps/job-search/hooks/useQueryString.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ const useQueryString = (urlParams: URLParams): string => {
const leftovers = promoted.length % globalSize;

// Promoted take up the whole, no need to retrieve anything.
if (promotedToShow >= globalSize) {
if (Number(promotedToShow) >= globalSize) {
return [0, 0];
}

Expand Down

0 comments on commit 9067b6e

Please sign in to comment.