mirror of
https://github.com/logos-blockchain/lez-explorer-ui.git
synced 2026-07-30 03:13:25 +00:00
fix: copilot comments, add guards for missing configs
This commit is contained in:
parent
ed99d63849
commit
4c3dac43e7
@ -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.
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user