Skip to content

Commit

Permalink
tidy(ui): remove extraneous fallback in QueueCountBadge
Browse files Browse the repository at this point in the history
  • Loading branch information
psychedelicious committed Sep 9, 2024
1 parent ee89b9f commit 497cc55
Showing 1 changed file with 1 addition and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { Badge, Portal } from '@invoke-ai/ui-library';
import { useStore } from '@nanostores/react';
import { createSelector } from '@reduxjs/toolkit';
import { useAppSelector } from 'app/store/storeHooks';
import { selectActiveTab } from 'features/ui/store/uiSelectors';
import { $isLeftPanelOpen, TABS_WITH_LEFT_PANEL } from 'features/ui/store/uiSlice';
import { $isLeftPanelOpen } from 'features/ui/store/uiSlice';
import type { RefObject } from 'react';
import { memo, useEffect, useState } from 'react';
import { useGetQueueStatusQuery } from 'services/api/endpoints/queue';
Expand All @@ -12,13 +9,8 @@ type Props = {
targetRef: RefObject<HTMLDivElement>;
};

const selectActiveTabShouldShowBadge = createSelector(selectActiveTab, (activeTab) =>
TABS_WITH_LEFT_PANEL.includes(activeTab)
);

export const QueueCountBadge = memo(({ targetRef }: Props) => {
const [badgePos, setBadgePos] = useState<{ x: string; y: string } | null>(null);
const activeTabShouldShowBadge = useAppSelector(selectActiveTabShouldShowBadge);
const isParametersPanelOpen = useStore($isLeftPanelOpen);
const { queueSize } = useGetQueueStatusQuery(undefined, {
selectFromResult: (res) => ({
Expand Down Expand Up @@ -64,9 +56,6 @@ export const QueueCountBadge = memo(({ targetRef }: Props) => {
if (!isParametersPanelOpen) {
return null;
}
if (!activeTabShouldShowBadge) {
return null;
}

return (
<Portal>
Expand Down

0 comments on commit 497cc55

Please sign in to comment.