Skip to content

Commit

Permalink
Forms: remove programmatic highlight of the object (#245)
Browse files Browse the repository at this point in the history
  • Loading branch information
barabadzhi authored Jan 3, 2025
1 parent 325cff7 commit b0c4058
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 38 deletions.
49 changes: 26 additions & 23 deletions src/features/forms/routes/formsList/formsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -357,33 +357,36 @@ export function FormsList() {
</Button>
</Box>
</Box>
{(loadingTemplate || loadingItems) && (
{loadingTemplate || loadingItems ? (
<Box position="relative">
<LinearProgress />
</Box>
)}
<Typography py={2} px={1} fontWeight={600}>
{template?.title.value ?? ""}
</Typography>
<ScrollBox pb={2} flex={1}>
{items.length === 0 ? (
<Typography px={1}>{t("noForms")}</Typography>
) : (
<AutoSizer disableWidth>
{({ height }) => (
<List
height={height}
itemCount={filteredItems.length}
itemSize={48}
width="100%"
overscanCount={5}
>
{ListItem}
</List>
) : (
<>
<Typography py={2} px={1} fontWeight={600}>
{template?.title.value ?? ""}
</Typography>
<ScrollBox pb={2} flex={1}>
{items.length === 0 ? (
<Typography px={1}>{t("noForms")}</Typography>
) : (
<AutoSizer disableWidth>
{({ height }) => (
<List
height={height}
itemCount={filteredItems.length}
itemSize={48}
width="100%"
overscanCount={5}
>
{ListItem}
</List>
)}
</AutoSizer>
)}
</AutoSizer>
)}
</ScrollBox>
</ScrollBox>
</>
)}
<FormFilterMenu
anchorEl={filterMenuAnchor}
open={Boolean(filterMenuAnchor)}
Expand Down
18 changes: 3 additions & 15 deletions src/features/forms/routes/object.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { Redirect, useHistory, useParams } from "react-router-dom";
import { useAppDispatch, useAppSelector } from "app/redux-store-interactions";
import { Divider, ScrollBox } from "components";
import { useExplorerGlobals } from "contexts/explorerGlobals";
import { highlightActions, useDispatchHighlighted, useHighlighted } from "contexts/highlighted";
import { highlightActions, useDispatchHighlighted } from "contexts/highlighted";
import { renderActions } from "features/render";
import { useAbortController } from "hooks/useAbortController";
import { useSceneId } from "hooks/useSceneId";
Expand All @@ -39,7 +39,6 @@ export function Object() {
const sceneId = useSceneId();
const currentFormsList = useAppSelector(selectCurrentFormsList);
const [abortController] = useAbortController();
const { idArr: highlighted } = useHighlighted();
const dispatch = useAppDispatch();
const dispatchHighlighted = useDispatchHighlighted();

Expand Down Expand Up @@ -82,18 +81,7 @@ export function Object() {
fetchData();
}, [id, db, abortSignal, dispatch]);

useEffect(() => {
if (!id || highlighted.includes(+id)) {
return;
}
dispatchHighlighted(highlightActions.setIds([+id]));
}, [dispatchHighlighted, id, highlighted]);

const {
data: forms,
isLoading: formsLoading,
isUninitialized,
} = useGetSearchFormsQuery(
const { data: forms = [], isLoading: formsLoading } = useGetSearchFormsQuery(
object?.guid
? {
projectId: sceneId,
Expand Down Expand Up @@ -147,7 +135,7 @@ export function Object() {
</Button>
</Box>
</Box>
{isLoading || formsLoading || isUninitialized ? (
{isLoading || formsLoading ? (
<Box position="relative">
<LinearProgress />
</Box>
Expand Down

0 comments on commit b0c4058

Please sign in to comment.