mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-18 17:13:47 +00:00
Remove @redux-devtools/extension dependency
Use the standard window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ runtime check instead of importing the package. DevTools still work if the browser extension is installed. Also inline the defaultMemoize usage from reselect to fix Vite dev server compatibility. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e593cc12da
commit
3e70353b36
4 changed files with 18 additions and 12 deletions
|
|
@ -18,7 +18,7 @@ import {
|
|||
PlayerMediaStatus,
|
||||
MediaStatus,
|
||||
} from "./types";
|
||||
import { createSelector, defaultMemoize } from "reselect";
|
||||
import { createSelector } from "reselect";
|
||||
import * as Utils from "./utils";
|
||||
import {
|
||||
TRACK_HEIGHT,
|
||||
|
|
@ -339,9 +339,15 @@ export const getDuration = (state: AppState): number | null => {
|
|||
};
|
||||
|
||||
export const getTrackDisplayName = createSelector(getTracks, (tracks) => {
|
||||
return defaultMemoize((trackId: number | null) =>
|
||||
fromTracks.getTrackDisplayName(tracks, trackId)
|
||||
);
|
||||
let lastArg: number | null | undefined;
|
||||
let lastResult: string | null;
|
||||
return (trackId: number | null) => {
|
||||
if (trackId !== lastArg) {
|
||||
lastArg = trackId;
|
||||
lastResult = fromTracks.getTrackDisplayName(tracks, trackId);
|
||||
}
|
||||
return lastResult;
|
||||
};
|
||||
});
|
||||
|
||||
export const getCurrentTrackDisplayName = createSelector(
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import {
|
||||
legacy_createStore as createStore,
|
||||
applyMiddleware,
|
||||
compose as reduxCompose,
|
||||
Middleware as ReduxMiddleware,
|
||||
} from "redux";
|
||||
import { withExtraArgument } from "redux-thunk";
|
||||
import { composeWithDevTools } from "@redux-devtools/extension";
|
||||
import reducer from "./reducers";
|
||||
import mediaMiddleware from "./mediaMiddleware";
|
||||
import { merge } from "./utils";
|
||||
|
|
@ -19,9 +19,13 @@ import {
|
|||
Store,
|
||||
} from "./types";
|
||||
|
||||
const compose = composeWithDevTools({
|
||||
actionsDenylist: ["UPDATE_TIME_ELAPSED", "STEP_MARQUEE"],
|
||||
});
|
||||
// Use Redux DevTools extension if available, otherwise plain compose
|
||||
const compose =
|
||||
(typeof window !== "undefined" &&
|
||||
(window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?.({
|
||||
actionsDenylist: ["UPDATE_TIME_ELAPSED", "STEP_MARQUEE"],
|
||||
})) ||
|
||||
reduxCompose;
|
||||
|
||||
export default function createWebampStore(
|
||||
media: IMedia,
|
||||
|
|
|
|||
|
|
@ -108,7 +108,6 @@
|
|||
"trailingComma": "es5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@redux-devtools/extension": "^3.3.0",
|
||||
"@sentry/browser": "5.9.1",
|
||||
"butterchurn": "3.0.0-beta.5",
|
||||
"butterchurn-presets": "3.0.0-beta.4",
|
||||
|
|
|
|||
3
pnpm-lock.yaml
generated
3
pnpm-lock.yaml
generated
|
|
@ -323,9 +323,6 @@ importers:
|
|||
|
||||
packages/webamp:
|
||||
dependencies:
|
||||
'@redux-devtools/extension':
|
||||
specifier: ^3.3.0
|
||||
version: 3.3.0(redux@5.0.1)
|
||||
'@sentry/browser':
|
||||
specifier: 5.9.1
|
||||
version: 5.9.1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue