-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Fix unnecessary content refreshing #14705
Fix unnecessary content refreshing #14705
Conversation
This is ready to review as-is, but it may not fix the issue 100%. If this is a problem, there are two ideas I have to do here:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already much better.
I suggest this, it makes the debug output more readable by updating translations for all mods at once:
diff --git a/builtin/mainmenu/content/pkgmgr.lua b/builtin/mainmenu/content/pkgmgr.lua
index 720c435c4..891421100 100644
--- a/builtin/mainmenu/content/pkgmgr.lua
+++ b/builtin/mainmenu/content/pkgmgr.lua
@@ -150,8 +150,6 @@ function pkgmgr.get_mods(path, virtual_path, listing, modpack)
toadd.virtual_path = mod_virtual_path
toadd.type = "mod"
- pkgmgr.update_translations({ toadd })
-
-- Check modpack.txt
-- Note: modpack.conf is already checked above
local modpackfile = io.open(mod_path .. DIR_DELIM .. "modpack.txt")
@@ -176,6 +174,8 @@ function pkgmgr.get_mods(path, virtual_path, listing, modpack)
table.sort(listing, function(a, b)
return a.virtual_path:lower() < b.virtual_path:lower()
end)
+
+ pkgmgr.update_translations(listing)
end
end
I think it would be good to cache texture packs as well. Basically pkgmgr.get_all()
is called on every single formspec interaction because the "Content" tabheader includes an update count.
ERROR[Main]: Updating translations for 83 items
[Main]: stack traceback:
/mt/builtin/mainmenu/content/pkgmgr.lua:795: in function 'update_translations'
/mt/builtin/mainmenu/content/pkgmgr.lua:194: in function 'get_texture_packs'
/mt/builtin/mainmenu/content/pkgmgr.lua:220: in function 'get_all'
/mt/builtin/mainmenu/content/update_detector.lua:128: in function 'get_all'
/mt/builtin/mainmenu/content/update_detector.lua:151: in function 'get_count'
/mt/builtin/mainmenu/tab_content.lua:286: in function 'caption'
/mt/builtin/fstk/tabview.lua:164: in function 'tab_header'
/mt/builtin/fstk/tabview.lua:86: in function 'get_formspec'
/mt/builtin/fstk/ui.lua:101: in function 'update'
/mt/builtin/fstk/ui.lua:145: in function 'handle_buttons'
/mt/builtin/fstk/ui.lua:186: in function /mt/builtin/fstk/ui.lua:172>
Another problem is that the mod list is still loaded twice on startup. A log excerpt: log.txt |
Looks like this is due to the settingtypes loading code |
811c415
to
0a5ac08
Compare
0a5ac08
to
547f1a4
Compare
5e08bed
to
429f868
Compare
429f868
to
f627bf8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enabling/disabling texture packs doesn't work properly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested:
- uninstall reloads by type correctly
- update reloads by type correctly
- install reloads by type correctly
- enabling/disabling texture packs works (and reloads, I guess that would be avoidable)
- builtin/game/mod/client mod settings are loaded
Fixes #14655
To do
This PR is Ready for Review
How to test