fix: copilot comments, add guards for missing configs

This commit is contained in:
erhant 2026-07-02 15:07:56 +03:00
parent ed99d63849
commit 4c3dac43e7
2 changed files with 15 additions and 0 deletions

View File

@ -400,6 +400,14 @@ bool LezExplorerUiBackend::applyConfigJson(QString json) {
}
bool LezExplorerUiBackend::resetIndexerCache() {
// A saved config is required: reset_storage reads the channel from it, and we
// restart from it afterwards. Without one there's nothing to reset against, so
// don't wipe-then-fail-to-restart.
if (readConfigFile().trimmed().isEmpty()) {
emit error(QStringLiteral("Save an indexer config before deleting the cache."));
return false;
}
// reset_storage stops the indexer and deletes its RocksDB store; then we
// restart from the saved config so it re-indexes the current chain from
// scratch. The recovery path for a store left stale against a reset chain.

View File

@ -155,6 +155,13 @@ Item {
function resetCache() {
if (!page.backend)
return;
// Nothing to reset to until a config has been saved; don't arm the
// destructive confirm point the user at Save first.
if (!page.backend.configText || page.backend.configText.length === 0) {
page.confirmingReset = false;
page.setStatus("Save an indexer config first, then you can delete the cache.", true);
return;
}
if (!page.confirmingReset) {
page.confirmingReset = true;
page.setStatus("Click “Confirm delete” to wipe the local index and re-sync from scratch.", true);