Skip to content

Commit

Permalink
fix issue with react-virtual upgrade, and organize some imports
Browse files Browse the repository at this point in the history
  • Loading branch information
zoran995 committed Sep 19, 2021
1 parent fc8eef2 commit b6390c5
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 18 deletions.
2 changes: 1 addition & 1 deletion lib/Models/ItemSearchProviders/EnumIndex.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import joinUrl from "./joinUrl";
import loadCsv from "../../Core/loadCsv";
import joinUrl from "./joinUrl";
import { IndexBase, IndexType } from "./Types";

// IDs of enum to search
Expand Down
2 changes: 1 addition & 1 deletion lib/Models/ItemSearchProviders/Index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import NumericIndex from "./NumericIndex";
import TextIndex from "./TextIndex";
import { IndexType, indexTypes } from "./Types";

export { IndexType, indexTypes } from "./Types";
export { default as EnumIndex } from "./EnumIndex";
export { default as NumericIndex } from "./NumericIndex";
export { IndexType, indexTypes } from "./Types";

// IndexRoot holds the indexes for each property and top level options
export type IndexRoot = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { action } from "mobx";
import loadCsv from "../../Core/loadCsv";
import loadJson5 from "../../Core/loadJson5";
import { SearchParameterTraits } from "../../Traits/TraitsClasses/SearchableItemTraits";
import { Index, IndexRoot, IndexType, parseIndexRoot } from "./Index";
import ItemSearchProvider, {
ItemSearchParameter,
ItemSearchResult
} from "./ItemSearchProvider";
import { Index, IndexRoot, IndexType, parseIndexRoot } from "./Index";
import joinUrl from "./joinUrl";

const t = i18next.t.bind(i18next);
Expand Down
2 changes: 0 additions & 2 deletions lib/Models/ItemSearchProviders/ItemSearchProvider.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import BoundingSphere from "terriajs-cesium/Source/Core/BoundingSphere";
import Cartographic from "terriajs-cesium/Source/Core/Cartographic";
import { SearchParameterTraits } from "../../Traits/TraitsClasses/SearchableItemTraits";

export type ItemSearchParameter =
Expand Down
2 changes: 1 addition & 1 deletion lib/Models/ItemSearchProviders/ItemSearchProviders.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Constructor from "../../Core/Constructor";
import ItemSearchProvider from "./ItemSearchProvider";
import IndexedItemSearchProvider from "./IndexedItemSearchProvider";
import ItemSearchProvider from "./ItemSearchProvider";

export const ItemSearchProviders: Map<
string,
Expand Down
6 changes: 3 additions & 3 deletions lib/Models/ItemSearchProviders/NumericIndex.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import joinUrl from "./joinUrl";
import loadCsv from "../../Core/loadCsv";
import { IndexBase, IndexType } from "./Types";
import sortedIndexBy from "lodash-es/sortedIndexBy";
import sortedLastIndexBy from "lodash-es/sortedLastIndexBy";
import loadCsv from "../../Core/loadCsv";
import joinUrl from "./joinUrl";
import { IndexBase, IndexType } from "./Types";

// Minimum and maxiumum values in a numeric range
export type NumericRange = { min: number; max: number };
Expand Down
2 changes: 1 addition & 1 deletion lib/ReactViews/Tools/ItemSearchTool/BackButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { FC } from "react";
import { useTheme } from "styled-components";
import { BoxSpan } from "../../../Styled/Box";
import Button from "../../../Styled/Button";
import { TextSpan } from "../../../Styled/Text";
import { GLYPHS, StyledIcon } from "../../../Styled/Icon";
import { TextSpan } from "../../../Styled/Text";

const BackButton: FC<{ onClick: () => void }> = ({ children, onClick }) => {
const theme = useTheme();
Expand Down
1 change: 0 additions & 1 deletion lib/ReactViews/Tools/ItemSearchTool/ErrorComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { FC } from "react";

import Text from "../../../Styled/Text";

const ErrorComponent: FC = ({ children }) => {
Expand Down
8 changes: 4 additions & 4 deletions lib/ReactViews/Tools/ItemSearchTool/SearchForm.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { WithT } from "i18next";
import isEmpty from "lodash-es/isEmpty";
import { FC, FormEvent, ChangeEvent, useEffect, useState } from "react";
import { ChangeEvent, FC, FormEvent, useEffect, useState } from "react";
import {
useTranslation,
WithTranslation,
Expand All @@ -16,12 +16,12 @@ import ItemSearchProvider, {
NumericItemSearchParameter,
TextItemSearchParameter
} from "../../../Models/ItemSearchProviders/ItemSearchProvider";
import Box from "../../../Styled/Box";
import Button from "../../../Styled/Button";
import Text from "../../../Styled/Text";
import ErrorComponent from "./ErrorComponent";
import { ItemSearchQuery } from "./ItemSearchTool";
import Loading from "./Loading";
import Text from "../../../Styled/Text";
import Box from "../../../Styled/Box";
import Button from "../../../Styled/Button";

export interface SearchFormProps extends WithTranslation {
itemSearchProvider: ItemSearchProvider;
Expand Down
4 changes: 2 additions & 2 deletions lib/ReactViews/Tools/ItemSearchTool/SearchResults.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { observer } from "mobx-react";
import Mustache from "mustache";
import { FC, MouseEventHandler, createRef, useCallback, useState } from "react";
import { FC, MouseEventHandler, useCallback, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import { useVirtual } from "react-virtual";
import styled from "styled-components";
Expand Down Expand Up @@ -28,7 +28,7 @@ const SearchResults: FC<SearchResultsProps> = props => {
currentMapEffect.is === "highlightSingleResult"
? currentMapEffect.result
: undefined;
const parentRef = createRef<HTMLDivElement>();
const parentRef = useRef<HTMLDivElement>(null);
const list = useVirtual({
size: results.length,
parentRef,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
"react-swipeable": "^5.1.0",
"react-transition-group": "^4.3.0",
"react-uid": "^2.3.0",
"react-virtual": "^2.7.0",
"react-virtual": "^2.8.1",
"resolve-url-loader": "^3.0.1",
"retry": "^0.12.0",
"rollbar": "^2.24.0",
Expand Down

0 comments on commit b6390c5

Please sign in to comment.