Skip to content

实战列表缓存键使用 Bool toggle 导致前进一步变慢 #65

@gooooloo

Description

@gooooloo

问题描述

Session.relatedRealGamesForCurrentFen 的缓存版本键使用了 self.dataChanged(Bool toggle),该值在每次 notifyDataChanged() 调用时都会翻转,导致前进/后退每一步缓存都不命中,每步都重新执行 computeRelatedRealGames()

引入提交:da26a6e(实战列表功能 #54

期望行为

缓存版本键应使用 databaseView.dataVersion(递增 Int),仅在数据库内容真正修改时才失效,前进/后退导航时缓存应正确命中。

修复

_cachedRealGamesDataVersion 类型从 Bool 改为 Int,缓存键从 self.dataChanged 改为 databaseView.dataVersion

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions