fix(ManagedPagePage): don't reload pack info when not needed

Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
flow 2022-11-19 08:36:12 -03:00
parent 089018015a
commit 4e75419e08
No known key found for this signature in database
GPG Key ID: 8D0F221F0A59F469

View File

@ -66,6 +66,7 @@ ManagedPackPage::ManagedPackPage(BaseInstance* inst, InstanceWindow* instance_wi
connect(ui->reloadButton, &QPushButton::clicked, this, [this](bool){ connect(ui->reloadButton, &QPushButton::clicked, this, [this](bool){
ui->reloadButton->setVisible(false); ui->reloadButton->setVisible(false);
m_loaded = false;
// Pretend we're opening the page again // Pretend we're opening the page again
openedImpl(); openedImpl();
}); });
@ -179,6 +180,10 @@ void ModrinthManagedPackPage::parseManagedPack()
{ {
qDebug() << "Parsing Modrinth pack"; qDebug() << "Parsing Modrinth pack";
// No need for the extra work because we already have everything we need.
if (m_loaded)
return;
if (m_fetch_job && m_fetch_job->isRunning()) if (m_fetch_job && m_fetch_job->isRunning())
m_fetch_job->abort(); m_fetch_job->abort();
@ -318,6 +323,10 @@ void FlameManagedPackPage::parseManagedPack()
return; return;
} }
// No need for the extra work because we already have everything we need.
if (m_loaded)
return;
if (m_fetch_job && m_fetch_job->isRunning()) if (m_fetch_job && m_fetch_job->isRunning())
m_fetch_job->abort(); m_fetch_job->abort();