1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-04 12:41:46 +00:00

fix: enhance overview scan UI and invalidate cache on refresh

- Invalidate disk cache for overview entries on refresh to ensure fresh data.

- Show dynamic status messages (e.g., 'Scanning Applications...') instead of static text in Overview.

- Adjust spinner animation speed to 100ms for smoother visual experience.
This commit is contained in:
Tw93
2026-01-12 11:42:07 +08:00
parent 67e2d2e86d
commit 8aee56b7fa
2 changed files with 8 additions and 3 deletions

View File

@@ -394,7 +394,7 @@ func (m model) scanCmd(path string) tea.Cmd {
}
func tickCmd() tea.Cmd {
return tea.Tick(time.Millisecond*80, func(t time.Time) tea.Msg {
return tea.Tick(time.Millisecond*100, func(t time.Time) tea.Msg {
return tickMsg(t)
})
}
@@ -683,6 +683,11 @@ func (m model) updateKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
m.largeMultiSelected = make(map[string]bool)
if m.inOverviewMode() {
// Explicitly invalidate cache for all overview entries to force re-scan
for _, entry := range m.entries {
invalidateCache(entry.Path)
}
m.overviewSizeCache = make(map[string]int64)
m.overviewScanningSet = make(map[string]bool)
m.hydrateOverviewEntries() // Reset sizes to pending

View File

@@ -32,7 +32,7 @@ func (m model) View() string {
return b.String()
} else {
fmt.Fprintf(&b, "%sSelect a location to explore:%s ", colorGray, colorReset)
fmt.Fprintf(&b, "%s%s%s%s Scanning...\n\n", colorCyan, colorBold, spinnerFrames[m.spinner], colorReset)
fmt.Fprintf(&b, "%s%s%s%s %s\n\n", colorCyan, colorBold, spinnerFrames[m.spinner], colorReset, m.status)
}
} else {
hasPending := false
@@ -44,7 +44,7 @@ func (m model) View() string {
}
if hasPending {
fmt.Fprintf(&b, "%sSelect a location to explore:%s ", colorGray, colorReset)
fmt.Fprintf(&b, "%s%s%s%s Scanning...\n\n", colorCyan, colorBold, spinnerFrames[m.spinner], colorReset)
fmt.Fprintf(&b, "%s%s%s%s %s\n\n", colorCyan, colorBold, spinnerFrames[m.spinner], colorReset, m.status)
} else {
fmt.Fprintf(&b, "%sSelect a location to explore:%s\n\n", colorGray, colorReset)
}