Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Ensure issuesGroupedState is up to date #348

Merged

Conversation

SgtPooki
Copy link
Contributor

@SgtPooki SgtPooki commented Mar 28, 2023

@SgtPooki SgtPooki linked an issue Mar 28, 2023 that may be closed by this pull request
@vercel
Copy link

vercel bot commented Mar 28, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
starmaps ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 28, 2023 at 9:28PM (UTC)

Copy link
Contributor Author

@SgtPooki SgtPooki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self review and comments

@@ -114,7 +105,7 @@ export function RoadmapDetailed({

return innerDayjsDates;
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [issuesGroupedState.length, issuesGroupedId]);
}, [issuesGroupedState, issuesGroupedId]);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useHookstateMemo properly recognizes uniqueness of hookState objects.

setIssuesGroupedState(() => convertIssueDataStateToDetailedViewGroupOld(issueDataState, viewMode, query))
}
}, [viewMode, query, setIssuesGroupedState, issueDataState, groupedIssuesIdPrev, groupedIssuesId]);
const memoGrouped = useHookstateMemo(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useHookstateMemo properly recognizes uniqueness of hookState objects.

Comment on lines +136 to +144
const invalidGroups = issuesGroupedState.filter((group) => group.ornull == null || group.items.ornull == null)
if (issuesGroupedState.value.length === 0 || invalidGroups.length > 0) {
if (invalidGroups.length > 0) {
invalidGroups.forEach((g) => {
console.warn('Found an invalid group: ', g.value);
});
}
return <Spinner />;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only processing invalidGroups after globalLoadingState check

const issuesGroupedState = useHookstate<DetailedViewGroup[]>([]);
const groupedIssuesId = getUniqIdForGroupedIssues(issuesGroupedState.value)
const groupedIssuesIdPrev = usePrevious(groupedIssuesId);
const globalLoadingState = useGlobalLoadingState();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moving global loading state up to the top

@@ -71,10 +71,9 @@ export function RoadmapTabbedView({
}

return (
<Skeleton isLoaded={!globalLoadingState.get()}>
<Skeleton isLoaded={!globalLoadingState.get()} key={index}>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix react warning

@@ -33,13 +33,12 @@ export function GridRow({
const viewMode = useViewMode();
const routerQuery = useRouter().query;
const [closestDateIdx, setClosestDateIdx] = useState(Math.round(globalTimeScaler.getColumn(dayjs.utc(milestone.due_date.get()).toDate())));
useEffect(() => {
useHookstateEffect(() => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: useHookstateEffect is supposed to recognize hookstate objects, but doesn't seem to work properly, unlike useHookstateMemo (which does work properly, not rerunning the hook callback if hookstate object wasn't changed)

Copy link
Collaborator

@whizzzkid whizzzkid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -5,7 +5,7 @@ const SvgDetailViewIcon = () => (
* From https://www.iconfinder.com/icons/326721/list_view_icon#svg
*/
<svg width="19" height="14" viewBox="0 0 19 14" xmlns="http://www.w3.org/2000/svg" version="1.1">
<g fill="none" fill-rule="evenodd" id="Page-1" stroke="#fff" stroke-width="1">
<g fill="none" fillRule="evenodd" id="Page-1" stroke="#fff" strokeWidth="1">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 Did this API change?

Comment on lines +139 to +141
invalidGroups.forEach((g) => {
console.warn('Found an invalid group: ', g.value);
});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optionally

Suggested change
invalidGroups.forEach((g) => {
console.warn('Found an invalid group: ', g.value);
});
invalidGroups.forEach(({value}) => console.warn('Found an invalid group: ', value));

@SgtPooki SgtPooki merged commit 9dca506 into main Mar 30, 2023
@SgtPooki SgtPooki deleted the 347-bug-detail-view-not-loading-properly-on-initial-load branch March 30, 2023 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: detail view not loading properly on initial load
2 participants