Skip to content
Closed
Show file tree
Hide file tree
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
7 changes: 5 additions & 2 deletions src/renderer/components/Sidebar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,9 @@ describe('renderer/components/Sidebar.tsx', () => {
isFetching: true,
});

expect(screen.getByTestId('sidebar-refresh')).toHaveClass('animate-spin');
const refreshButton = screen.getByTestId('sidebar-refresh');
expect(refreshButton).not.toHaveClass('animate-spin');
expect(refreshButton.querySelector('svg')).toHaveClass('animate-spin');
});

it('does not animate the refresh icon when settled and no fetch is in flight', () => {
Expand All @@ -225,7 +227,8 @@ describe('renderer/components/Sidebar.tsx', () => {
isFetching: false,
});

expect(screen.getByTestId('sidebar-refresh')).not.toHaveClass('animate-spin');
const refreshButton = screen.getByTestId('sidebar-refresh');
expect(refreshButton.querySelector('svg')).not.toHaveClass('animate-spin');
});
});

Expand Down
9 changes: 6 additions & 3 deletions src/renderer/components/Sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { FC } from 'react';
import type { ComponentProps, FC } from 'react';

import {
BellIcon,
Expand All @@ -21,6 +21,10 @@ import { useAccountsStore, useFiltersStore, useSettingsStore } from '../stores';

import { LogoIcon } from './icons/LogoIcon';

const SpinningSyncIcon: FC<ComponentProps<typeof SyncIcon>> = (props) => (
<SyncIcon {...props} className="animate-spin" />
);

export const Sidebar: FC = () => {
const { status, notificationCount, hasUnreadNotifications, isFetching } = useNotifications();

Expand Down Expand Up @@ -124,11 +128,10 @@ export const Sidebar: FC = () => {
<>
<IconButton
aria-label="Refresh"
className={status === 'loading' || isFetching ? 'animate-spin' : ''}
data-testid="sidebar-refresh"
description="Refresh notifications"
disabled={isLoading}
icon={SyncIcon}
icon={status === 'loading' || isFetching ? SpinningSyncIcon : SyncIcon}
keybindingHint={shortcuts.refresh.key}
// loading={status === 'loading'}
onClick={() => shortcuts.refresh.action()}
Expand Down