Skip to content

Commit

Permalink
Add concat() to original array to stay immutable
Browse files Browse the repository at this point in the history
  • Loading branch information
HU-Lee committed Dec 17, 2024
1 parent 11784ac commit e867d12
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/components/organisms/analysis/LegacyAnalysis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const LegacyAnalysis: React.FC<AnalysisProps> = ({ allCharacters }) => {
const { t } = useTranslation();

const baseCharacters = allCharacters
.concat()
.filter((char) => getNumber(char) < 1000)
.sort((a, b) => a.id.localeCompare(b.id));

Expand Down
12 changes: 7 additions & 5 deletions src/components/organisms/analysis/LegacyTableAnalysis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ import DownloadButton from "../../atoms/button/Download";
const LegacyTableAnalysis: React.FC<AnalysisProps> = ({ allCharacters }) => {
const { t, i18n } = useTranslation();
const { setModal } = useModalStore();
const baseCharacters = allCharacters.sort((a, b) =>
getShortName(t(a.code), i18n.language).localeCompare(
getShortName(t(b.code), i18n.language)
)
);
const baseCharacters = allCharacters
.concat()
.sort((a, b) =>
getShortName(t(a.code), i18n.language).localeCompare(
getShortName(t(b.code), i18n.language)
)
);

return (
<>
Expand Down
3 changes: 2 additions & 1 deletion src/components/organisms/analysis/StardreamAnalysis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ const StardreamAnalysis: React.FC<AnalysisProps> = ({ allCharacters }) => {
const { t, i18n } = useTranslation();

const baseCharacters = allCharacters
.concat()
.filter(
(char, idx) =>
char.category === AECategories.encounter &&
char.style !== AECharacterStyles.four &&
(!ShowRecentStyles ||
!allCharacters
.slice(idx+1)
.slice(idx + 1)
.map((c) => c.code)
.includes(char.code)) &&
(!ShowSevenPiece ||
Expand Down
1 change: 1 addition & 0 deletions src/components/organisms/analysis/WhiteKeyAnalysis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const WhiteKeyAnalysis: React.FC<AnalysisProps> = ({ allCharacters }) => {
const { t, i18n } = useTranslation();

const baseCharacters = allCharacters
.concat()
.filter(
(char) =>
char.category === AECategories.encounter &&
Expand Down

0 comments on commit e867d12

Please sign in to comment.