Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Commit 578f86e

Browse files
avoid the closure
1 parent b01efba commit 578f86e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/SqlStreamStoreBrowser.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import { connect, createState } from './reactive';
2828
import { actions, store, Viewer } from './stream-store';
2929
import themes from './themes';
3030
import { AuthorizationProps, HalLink, HalLinks } from './types';
31-
import { mediaTypes } from './utils';
31+
import {mediaTypes, preventDefault} from './utils';
3232

3333
const getSelfAlias = (links: HalLinks) =>
3434
Object.keys(links)
@@ -90,14 +90,16 @@ const lightbulbs: { [key: string]: ComponentType<SvgIconProps> } = {
9090
light: LightbulbOutline,
9191
};
9292

93+
const onThemeToggle = preventDefault(() => themes.actions.type.next(void 0));
94+
9395
const Hero = ({ theme }: { theme: Theme }) => (
9496
<AppBar position={'static'}>
9597
<Toolbar>
9698
<SqlStreamStore color={'action'} />
9799
<Typography variant={'h6'} color={'inherit'}>
98100
Sql Stream Store
99101
</Typography>
100-
<IconButton onClick={() => themes.actions.type.next(void 0)}>
102+
<IconButton onClick={onThemeToggle}>
101103
{createElement(lightbulbs[theme.palette.type])}
102104
</IconButton>
103105
</Toolbar>

0 commit comments

Comments
 (0)