Skip to content

Commit

Permalink
fix setting ref level
Browse files Browse the repository at this point in the history
  • Loading branch information
Razzmatazzz committed Aug 30, 2024
1 parent f9ca514 commit ab50567
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/features/settings/settingsSlice.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ export const selectAllTraders = createSelector([selectSettings], (settings) => {
mechanic: settings[settings.gameMode].mechanic,
ragman: settings[settings.gameMode].ragman,
jaeger: settings[settings.gameMode].jaeger,
ref: settings[settings.gameMode].ref,
};
});

Expand Down
11 changes: 5 additions & 6 deletions src/pages/settings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function Settings() {
const hideDogtagBarters = useSelector((state) => state.settings[state.settings.gameMode].hideDogtagBarters);
const gameMode = useSelector((state) => state.settings.gameMode);

const refs = {
const stationRefs = {
'bitcoin-farm': useRef(null),
'booze-generator': useRef(null),
'christmas-tree': useRef(null),
Expand Down Expand Up @@ -104,11 +104,11 @@ function Settings() {
useEffect(() => {
if (useTarkovTracker) {
for (const stationKey in allStations) {
if (!refs[stationKey]) {
if (!stationRefs[stationKey]) {
continue;
}

refs[stationKey].current?.setValue({
stationRefs[stationKey].current?.setValue({
value: allStations[stationKey],
label: allStations[stationKey]
? allStations[stationKey].toString()
Expand Down Expand Up @@ -230,13 +230,13 @@ function Settings() {
<div className="settings-group-wrapper">
<h2>{t('Traders')}</h2>
{traders.map((trader) => {

return (
<StationSkillTraderSetting
key={trader.normalizedName}
label={trader.name}
type="trader"
stateKey={trader.normalizedName}
ref={refs[trader.normalizedName]}
/>
);
})}
Expand All @@ -250,7 +250,7 @@ function Settings() {
label={station.name}
type="station"
stateKey={station.normalizedName}
ref={refs[station.normalizedName]}
ref={stationRefs[station.normalizedName]}
isDisabled={useTarkovTracker}
image={station.imageLink}
/>
Expand All @@ -265,7 +265,6 @@ function Settings() {
key={skillKey}
type="skill"
stateKey={skillKey}
ref={refs[skillKey]}
/>
);
})}
Expand Down

0 comments on commit ab50567

Please sign in to comment.