[WEB-1603] fix: load more issues when issues are deleted (#4830)
* fix load more issues when issues are deleted * fix build
This commit is contained in:
parent
a8f4d21e8b
commit
bba10d7073
13 changed files with 55 additions and 18 deletions
|
|
@ -91,9 +91,15 @@ export const KanbanGroup = observer((props: IKanbanGroup) => {
|
|||
loadMoreIssues(groupId, sub_group_id === "null"? undefined: sub_group_id)
|
||||
}, [loadMoreIssues, groupId, sub_group_id])
|
||||
|
||||
useIntersectionObserver(containerRef, intersectionElement, loadMoreIssuesInThisGroup, `0% 100% 100% 100%`);
|
||||
const [isDraggingOverColumn, setIsDraggingOverColumn] = useState(false);
|
||||
const isPaginating = !!getIssueLoader(groupId);
|
||||
|
||||
useIntersectionObserver(
|
||||
containerRef,
|
||||
isPaginating ? null : intersectionElement,
|
||||
loadMoreIssuesInThisGroup,
|
||||
`0% 100% 100% 100%`
|
||||
);
|
||||
const [isDraggingOverColumn, setIsDraggingOverColumn] = useState(false);
|
||||
|
||||
// Enable Kanban Columns as Drop Targets
|
||||
useEffect(() => {
|
||||
|
|
@ -216,7 +222,6 @@ export const KanbanGroup = observer((props: IKanbanGroup) => {
|
|||
|
||||
const nextPageResults = getPaginationData(groupId, sub_group_id)?.nextPageResults;
|
||||
|
||||
const isPaginating = !!getIssueLoader(groupId, sub_group_id);
|
||||
|
||||
const loadMore = isPaginating ? (
|
||||
<KanbanIssueBlockLoader />
|
||||
|
|
|
|||
|
|
@ -98,12 +98,12 @@ export const ListGroup = observer((props: Props) => {
|
|||
|
||||
const [intersectionElement, setIntersectionElement] = useState<HTMLDivElement | null>(null);
|
||||
|
||||
useIntersectionObserver(containerRef, intersectionElement, loadMoreIssues, `50% 0% 50% 0%`);
|
||||
|
||||
const groupIssueCount = getGroupIssueCount(group.id, undefined, false) ?? 0;
|
||||
const nextPageResults = getPaginationData(group.id, undefined)?.nextPageResults;
|
||||
const isPaginating = !!getIssueLoader(group.id);
|
||||
|
||||
useIntersectionObserver(containerRef, isPaginating ? null : intersectionElement, loadMoreIssues, `50% 0% 50% 0%`);
|
||||
|
||||
const shouldLoadMore =
|
||||
nextPageResults === undefined && groupIssueCount !== undefined && groupIssueIds
|
||||
? groupIssueIds.length < groupIssueCount
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { IIssueDisplayFilterOptions, IIssueDisplayProperties, TIssue } from "@pl
|
|||
import { SpreadsheetIssueRowLoader } from "@/components/ui/loader";
|
||||
//hooks
|
||||
import { useIntersectionObserver } from "@/hooks/use-intersection-observer";
|
||||
import { useIssuesStore } from "@/hooks/use-issue-layout-store";
|
||||
import { TSelectionHelper } from "@/hooks/use-multiple-select";
|
||||
import { useTableKeyboardNavigation } from "@/hooks/use-table-keyboard-navigation";
|
||||
// components
|
||||
|
|
@ -52,6 +53,10 @@ export const SpreadsheetTable = observer((props: Props) => {
|
|||
const isScrolled = useRef(false);
|
||||
const [intersectionElement, setIntersectionElement] = useState<HTMLTableSectionElement | null>(null);
|
||||
|
||||
const {
|
||||
issues: { getIssueLoader },
|
||||
} = useIssuesStore();
|
||||
|
||||
const handleScroll = useCallback(() => {
|
||||
if (!containerRef.current) return;
|
||||
const scrollLeft = containerRef.current.scrollLeft;
|
||||
|
|
@ -85,7 +90,9 @@ export const SpreadsheetTable = observer((props: Props) => {
|
|||
};
|
||||
}, [handleScroll, containerRef]);
|
||||
|
||||
useIntersectionObserver(containerRef, intersectionElement, loadMoreIssues, `50% 0% 50% 0%`);
|
||||
const isPaginating = !!getIssueLoader();
|
||||
|
||||
useIntersectionObserver(containerRef, isPaginating ? null : intersectionElement, loadMoreIssues, `50% 0% 50% 0%`);
|
||||
|
||||
const handleKeyBoardNavigation = useTableKeyboardNavigation();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue