Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Settings are saved multiple times just by opening the settings screen #1463

Closed
arielj opened this issue Jun 12, 2022 · 1 comment
Closed
Assignees

Comments

@arielj
Copy link
Collaborator

arielj commented Jun 12, 2022

Describe the bug

When opening any settings screen (either Heroic's or a game), configuration is saved to disk multiple times.

Opening Heroic's settings the first time it writes the config 13 times. After that, changing to another sub-section (General, Wine, Other, etc), write the settings 3 more times. That's without doing any change.

Opening a game's settings the first time it writes the game's config 8 times for one game, 15 times for another, 16 times for another. After that, changing sub-sections writes the config 3 times for every section.

Going to another screen and back to settings starts with all the writes again.

Add logs

Nothing shows up on the logs, I put a console.log('writing config') in this useEffect in the settings index

  useEffect(() => {
    console.log('writing config')
    writeConfig([appName, settingsToSave])
  }, [GlobalSettings, GameSettings, appName])

This is just opening the settings for Magic The Gathering Arena (no changes at all)

image

Steps to reproduce

  1. Add the code shared above in the settings index.tsx line 329
  2. Open DevTools in Heroic and go to the console tab
  3. Enter the settings for heroic or any game, move around
  4. Multiple writing config lines are logged in the console

Expected behavior

Configuration should only be written when it changes, and only once. It should also NOT be written when opening settings or changing between sections.

Screenshots

No response

System Information

  • Heroic Version [e. g. 2.1.1]: current beta branch, but it's a long running issue since older versions

Additional information

I'm already debugging this trying to refactor it (I assigned this to me already), I'm creating the issue to keep track of it.

@arielj arielj self-assigned this Jun 12, 2022
@flavioislima
Copy link
Member

implemented

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants