Skip to content
Merged
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
19 changes: 16 additions & 3 deletions src/components/issues/IssuesList.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import React, { useCallback, useEffect, useMemo, useState } from 'react';
import React, {
useCallback,
useEffect,
useLayoutEffect,
useMemo,
useState,
} from 'react';
import {
DebouncedSearchInput,
useDebouncedSearchDraft,
Expand Down Expand Up @@ -272,8 +278,15 @@ const IssuesList: React.FC<IssuesListProps> = ({
);

const isLargeScreen = useMediaQuery(theme.breakpoints.up('xl'));
const [portalTarget, setPortalTarget] = useState<HTMLElement | null>(null);
useEffect(() => {
// Resolve the sidebar portal target synchronously so a tab switch (which
// remounts this list) renders straight into the sidebar instead of
// flashing the toolbar inline for one frame.
const [portalTarget, setPortalTarget] = useState<HTMLElement | null>(() =>
document.getElementById('tabs-options-portal'),
);
// On the very first page load the portal node is committed after this
// list's first render — pick it up before paint to avoid a flash.
useLayoutEffect(() => {
setPortalTarget(document.getElementById('tabs-options-portal'));
}, []);

Expand Down
Loading