Skip to content

Commit

Permalink
RC2 WWW timing fix (#1173)
Browse files Browse the repository at this point in the history
* Combining two useEffects in our settings page to hopefully offset timings

* Removing update available addons as we use peripherals now

* Removing update addons from display config
  • Loading branch information
arntsonl authored Oct 1, 2024
1 parent f71ef96 commit b675e94
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 29 deletions.
20 changes: 0 additions & 20 deletions www/src/Contexts/AppContext.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ export const AppContextProvider = ({ children, ...props }) => {
basePeripheralMapping,
);
const [expansionPins, setExpansionPins] = useState({});
const [availableAddons, setAvailableAddons] = useState({});

const updateUsedPins = async () => {
const data = await WebApi.getUsedPins(setLoading);
Expand Down Expand Up @@ -268,23 +267,6 @@ export const AppContextProvider = ({ children, ...props }) => {

useEffect(() => {}, [availablePeripherals, setAvailablePeripherals]);

useEffect(() => {
async function fetchData() {
const data = await WebApi.getAddonsOptions(setLoading);
setAvailableAddons(data);
}
fetchData();
}, []);

const updateAddons = async () => {
const data = await WebApi.getAddonsOptions(setLoading);
setAvailableAddons(data);
};

const getAvailableAddons = () => {
return availableAddons;
};

const [savedColorScheme, _setSavedColorScheme] = useState(
localStorage.getItem('savedColorScheme') || 'auto',
);
Expand Down Expand Up @@ -317,8 +299,6 @@ export const AppContextProvider = ({ children, ...props }) => {
availablePeripherals,
getAvailablePeripherals,
expansionPins,
getAvailableAddons,
updateAddons,
getSelectedPeripheral,
setButtonLabels,
setGradientNormalColor1,
Expand Down
2 changes: 0 additions & 2 deletions www/src/Pages/DisplayConfig.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ export default function DisplayConfigPage() {
getAvailablePeripherals,
getSelectedPeripheral,
updatePeripherals,
updateAddons,
} = useContext(AppContext);
const [saveMessage, setSaveMessage] = useState('');

Expand All @@ -218,7 +217,6 @@ export default function DisplayConfigPage() {
);

useEffect(() => {
updateAddons();
updatePeripherals();
}, []);

Expand Down
9 changes: 2 additions & 7 deletions www/src/Pages/SettingsPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,6 @@ export default function SettingsPage() {
buttonLabels,
setButtonLabels,
getAvailablePeripherals,
updateAddons,
updatePeripherals,
} = useContext(AppContext);

Expand All @@ -488,6 +487,7 @@ export default function SettingsPage() {

useEffect(() => {
fetchProfiles();
updatePeripherals();
}, []);

const [saveMessage, setSaveMessage] = useState('');
Expand Down Expand Up @@ -1110,11 +1110,6 @@ export default function SettingsPage() {

const { t } = useTranslation('');

useEffect(() => {
updateAddons();
updatePeripherals();
}, []);

const translatedInputBootModes = translateArray(
checkRequiredArray(INPUT_BOOT_MODES),
);
Expand Down Expand Up @@ -1458,7 +1453,7 @@ export default function SettingsPage() {
<div id="Hotkeys" hidden={values.lockHotkeys}>
{Object.keys(hotkeyFields).map((o, i) => (
<Form.Group
key={`hotkey-${i}`}
key={`hotkey-${i}-base`}
className="row mb-3"
>
<Col sm="auto">
Expand Down

0 comments on commit b675e94

Please sign in to comment.