Skip to content

Conversation

@AobaIwaki123
Copy link

@AobaIwaki123 AobaIwaki123 commented Dec 14, 2025

Summary

Add auto-refresh functionality for memo feeds.
Polls for new memos at a user-configured interval and automatically refreshes the list when updates are detected.

Tip

If you'd like to try this feature before the official release, pre-built Docker images are available at iwakiaoba/aoba-memos on Docker Hub.


Architecture

sequenceDiagram
    participant Hook as useAutoRefresh
    participant API as MemoService
    participant List as PagedMemoList
    
    loop Every interval (when visible & online)
        Hook->>API: ListMemos (pageSize=1)
        API-->>Hook: Latest memo
        alt New memo detected
            Hook->>List: onRefresh()
        end
    end
Loading

Related Issues


Changes

Proto Definitions

File Change
proto/api/v1/user_service.proto Add auto_refresh_interval field
proto/api/v1/instance_service.proto Add enable_explore_auto_refresh, min_auto_refresh_interval
proto/store/user_setting.proto Add auto_refresh_interval field
proto/store/instance_setting.proto Add enable_explore_auto_refresh, min_auto_refresh_interval

Backend

File Change
server/router/api/v1/user_service.go Handler/converter for auto_refresh_interval
server/router/api/v1/instance_service.go Converter for new instance settings

Frontend

File Change
web/src/hooks/useAutoRefresh.ts New - Polling hook
web/src/components/PagedMemoList/PagedMemoList.tsx Integrate useAutoRefresh
web/src/components/Settings/PreferencesSection.tsx User setting UI
web/src/components/Settings/InstanceSection.tsx Admin setting UI
web/src/pages/Home.tsx, Explore.tsx Pass autoRefresh prop
web/src/locales/{en,ja}.json Add translation keys

Behavior

User Settings

  • Location: Settings > Preferences > Auto-refresh interval
  • Input: Seconds (0 = disabled, default = 10)
  • Constraint: Must be ≥ admin-configured minimum

Admin Settings

  • Enable Explore page auto-refresh: Toggle auto-refresh on Explore page (disabled by default to prevent excessive server load from public page polling)
  • Minimum auto-refresh interval: Floor for user-configured interval (default = 1s, also for server load control)

Polling Logic

  • Pauses when tab is hidden
  • Pauses when offline
  • Refreshes only when new memos are detected

FieldMask Naming Convention

New fields use snake_case for FieldMask paths.

// Correct
["auto_refresh_interval"]

// Incorrect - causes encoding error
["autoRefreshInterval"]

JSON Encoding of Field Masks
In JSON, a field mask is encoded as a single string where paths are separated by a comma. Fields name in each path are converted to/from lower-camel naming conventions.

Protocol Buffers Well-Known Types - Protocol Buffers Documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant