Merge pull request #1181 from ektatas/fix-useless-first-comma
Some checks are pending
auto-documentation / documentation (push) Waiting to run
build and push docker image / build-node (push) Waiting to run
Style and build test / tsc (push) Waiting to run
Style and build test / eslint (push) Blocked by required conditions
Style and build test / prettier (push) Blocked by required conditions
Style and build test / build-test-windows-arm64 (push) Blocked by required conditions
Style and build test / build-test-linux-arm64 (push) Blocked by required conditions
Style and build test / build-test-macos-arm64 (push) Blocked by required conditions
Style and build test / build-test-windows-x64 (push) Blocked by required conditions
Style and build test / build-test-linux-x64 (push) Blocked by required conditions
Style and build test / build-test-macos-x64 (push) Blocked by required conditions

fix first comma when select all episodes
This commit is contained in:
Stratuma 2026-01-11 01:09:42 +01:00 committed by GitHub
commit 15067b19a4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -27,17 +27,15 @@ const EpisodeListing: React.FC = () => {
}, [store.episodeListing]); }, [store.episodeListing]);
const close = () => { const close = () => {
dispatch({ const mergedEpisodes = [...parseEpisodes(store.downloadOptions.e), ...selected];
type: 'episodeListing',
payload: []
});
dispatch({ dispatch({
type: 'downloadOptions', type: 'downloadOptions',
payload: { payload: {
...store.downloadOptions, ...store.downloadOptions,
e: `${[...new Set([...parseSelect(store.downloadOptions.e), ...selected])].join(',')}` e: serializeEpisodes(mergedEpisodes)
} }
}); });
dispatch({ type: 'episodeListing', payload: [] });
}; };
const getEpisodesForSeason = (season: string | 'all') => { const getEpisodesForSeason = (season: string | 'all') => {
@ -168,6 +166,16 @@ const EpisodeListing: React.FC = () => {
</Dialog> </Dialog>
); );
}; };
const parseEpisodes = (e: string): string[] => {
if (!e) return [];
return e
.split(',')
.map((s) => s.trim())
.filter((s) => s.length > 0);
};
const serializeEpisodes = (episodes: string[]): string => {
return [...new Set(episodes)].join(',');
};
const parseSelect = (s: string): string[] => { const parseSelect = (s: string): string[] => {
const ret: string[] = []; const ret: string[] = [];