Skip to content

feat: OneThing 桌面待办事项应用 - #1

Merged
smd-610 merged 1 commit into
masterfrom
feat/initial-app
Jun 15, 2026
Merged

feat: OneThing 桌面待办事项应用#1
smd-610 merged 1 commit into
masterfrom
feat/initial-app

Conversation

@smd-610

@smd-610 smd-610 commented Jun 15, 2026

Copy link
Copy Markdown
Owner

概述

OneThing — 基于 Tauri 2 的桌面待办事项应用,界面全中文,设计风格对标 Linear + Things 3。

技术栈

  • Tauri 2 + React 19 + TypeScript + Vite 7
  • Tailwind CSS v4 + shadcn/ui
  • SQLite (tauri-plugin-sql) + Zustand + Day.js
  • @dnd-kit 拖拽排序 + Lucide React 图标

功能

  • 任务 CRUD、拖拽排序、优先级(高/中/低)
  • 四种视图:日视图(快速添加 + 进度条)、周视图(7天网格)、月视图(日历)、年视图(GitHub 风格热力图 + 连续天数统计)
  • 深色/浅色主题切换,localStorage 持久化
  • SQLite 持久化存储,事务性排序更新
  • toggleTodo 竞态条件修复(pendingToggles 防重入 + loadTodos 等待守卫)

审查要点

  • src/stores/todo-store.ts — 竞态条件修复,await 前读取最新值
  • src/lib/database.ts — reorderTodos 事务包裹,getDb 并发保护
  • src/components/shared/TodoForm.tsx — useEffect 重置表单状态
  • src/components/shared/TodoItem.tsx — useShallow selector 优化

- 视图/侧边栏/表单等全部 UI 文本改为中文,dayjs locale 设为 zh-cn
- toggleTodo 改为 await 前读取最新值,避免并发切换时 state 覆盖
- loadTodos 新增守卫:等待 pendingToggles 完成后再读 DB,防止旧数据覆盖乐观更新
Copilot AI review requested due to automatic review settings June 15, 2026 12:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refines the todo app’s state/date handling to eliminate race conditions around toggling completion and to align calendar views’ week boundaries with the app’s Day.js locale configuration (zh-cn).

Changes:

  • Add a pendingToggles guard so loadTodos waits for in-flight toggleTodo updates before re-fetching.
  • Update toggleTodo to compute the new completed value from the latest store state right before the async DB update.
  • Remove manual +1 day offsets from week starts/ends in Week/Month/Year views so week calculations rely on Day.js locale week start.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/stores/todo-store.ts Adds pending-toggle coordination between toggleTodo and loadTodos to reduce race conditions.
src/components/views/YearView.tsx Aligns yearly heatmap week grid start with locale week boundaries.
src/components/views/WeekView.tsx Aligns weekly view start date with locale week boundaries.
src/components/views/MonthView.tsx Aligns monthly calendar range start/end with locale week boundaries.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/stores/todo-store.ts
Comment on lines +29 to +37
if (pendingToggles.size > 0) {
await new Promise<void>((resolve) => {
const check = () => {
if (pendingToggles.size === 0) resolve();
else setTimeout(check, 10);
};
check();
});
}
@smd-610
smd-610 merged commit 46e2d83 into master Jun 15, 2026
1 check passed
@smd-610
smd-610 deleted the feat/initial-app branch June 15, 2026 12:50
@smd-610
smd-610 restored the feat/initial-app branch June 15, 2026 12:50
@smd-610
smd-610 deleted the feat/initial-app branch June 15, 2026 12:51
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.

2 participants