Skip to content

Commit

Permalink
Fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
tonygoldcrest committed Feb 5, 2024
1 parent 92afd61 commit 221684b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/main/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const electronHandler = {
ipcRenderer.removeListener(channel, subscription);
};
},
once(channel: Channels, func: (...args: unknown[]) => void) {
once<T>(channel: Channels, func: (...args: T[]) => void) {
ipcRenderer.once(channel, (_event, ...args) => func(...args));
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/SheetMusic/SheetMusic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export function SheetMusic({
width: stave.getWidth() + 10,
height: stave.getHeight(),
}}
highlighted={isHighlighted}
$highlighted={isHighlighted}
onClick={() => {
if (!midi) {
return;
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/components/SheetMusic/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ export const MeasureHighlighted = css`
background: ${theme.color.primaryLightest};
`;

export const MeasureHighlight = styled.button<{ highlighted: boolean }>`
export const MeasureHighlight = styled.button<{ $highlighted: boolean }>`
position: absolute;
z-index: -3;
border-radius: ${theme.borderRadius}px;
border: 0;
background: transparent;
cursor: pointer;
${(props) => (props.highlighted ? MeasureHighlighted : '')}
${(props) => (props.$highlighted ? MeasureHighlighted : '')}
&:hover {
background: ${theme.color.background};
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/views/SelectSongView/SelectSongView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function SelectSongView() {

useEffect(() => {
window.electron.ipcRenderer.sendMessage('load-song-list');
window.electron.ipcRenderer.on<IpcLoadSongListResponse>(
window.electron.ipcRenderer.once<IpcLoadSongListResponse>(
'load-song-list',
(arg) => {
setSongList(arg);
Expand Down Expand Up @@ -85,7 +85,7 @@ export function SelectSongView() {
icon={<FontAwesomeIcon icon={faFolderTree} />}
onClick={() => {
window.electron.ipcRenderer.sendMessage('rescan-songs');
window.electron.ipcRenderer.on<IpcLoadSongListResponse>(
window.electron.ipcRenderer.once<IpcLoadSongListResponse>(
'rescan-songs',
(arg) => {
setSongList(arg);
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/views/SongView/SongView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function SongView() {
const navigate = useNavigate();

const loadSong = useCallback(() => {
window.electron.ipcRenderer.on<IpcLoadSongResponse>(
window.electron.ipcRenderer.once<IpcLoadSongResponse>(
'load-song',
({ data, midi, audio }) => {
setMidiData(midi);
Expand Down Expand Up @@ -249,7 +249,7 @@ export function SongView() {
<PlaybackContainer>
<Slider
defaultValue={0}
tooltipVisible={false}
tooltip={{ open: false }}
style={{
flexGrow: 1,
}}
Expand Down

0 comments on commit 221684b

Please sign in to comment.