Просмотр исходного кода

refactor: migrate from react-hotkeys to tinykeys and update analysis ledger

Yuki Takei 1 месяц назад
Родитель
Сommit
1ccc3b2484

+ 1 - 0
.kiro/specs/reduce-modules-loaded/analysis-ledger.md

@@ -27,6 +27,7 @@ Measured via `ChunkModuleStatsPlugin` in `next.config.utils.js`. The `initial` c
 | + date-fns locale subpath imports | 8.4 | **1,630** | 4,717 | 6,347 | 9,062 | 2026-02-20 |
 | + null-loader: i18next-fs-backend, bunyan, bunyan-format | 8.5 | **1,572** | 4,720 | 6,292 | 9,007 | 2026-02-20 |
 | + validator → isMongoId regex in LinkEditModal | 8.6 | **1,572** | 4,608 (-112) | 6,180 (-112) | 8,895 (-112) | 2026-02-20 |
+| + react-hotkeys → tinykeys migration | 8.7 | **1,573** (+1) | 4,516 (-92) | 6,089 (-91) | 8,802 (-93) | 2026-02-24 |
 
 > **Note**: Originally reported baseline was 51.5s, but automated measurement on the same machine consistently shows ~31s. The 51.5s figure may reflect cold cache, different system load, or an earlier codebase state.
 

+ 1 - 1
.kiro/specs/reduce-modules-loaded/spec.json

@@ -1,7 +1,7 @@
 {
   "feature_name": "reduce-modules-loaded",
   "created_at": "2026-02-18T00:00:00.000Z",
-  "updated_at": "2026-02-19T11:00:00.000Z",
+  "updated_at": "2026-02-24T05:30:00.000Z",
   "language": "en",
   "phase": "ready-for-implementation",
   "approvals": {

+ 17 - 0
.kiro/specs/reduce-modules-loaded/tasks.md

@@ -194,6 +194,23 @@ The following loop repeats until the user declares completion:
   - Result: initial: 1,572 (unchanged) / async-only: 4,608 (-112, -2.4%) / total: 6,180 (-112) / compiled: 8,895 (-112)
   - _Requirements: 4.1, 6.1_
 
+- [x] 8.7 Loop iteration 5: react-hotkeys → tinykeys migration
+  - Replaced `react-hotkeys` (91 async modules) with `tinykeys` (~400 byte, 1 module)
+  - Rewrote `HotkeysManager.tsx` to use tinykeys directly with inline key bindings
+  - Deleted `HotkeysDetector.jsx` (unused), `HotkeyStroke.js` (unused model)
+  - Removed `getHotkeyStrokes()` static methods from all 6 subscriber components
+  - Removed `react-hotkeys` dependency, added `tinykeys` dependency
+  - Added `HotkeysManager.spec.tsx` with 6 tests (single keys, modifier keys, editable target suppression)
+  - Refactored all 6 subscriber components to align with ideal patterns:
+    - Converted 4 JSX files to TypeScript (CreatePage, FocusToGlobalSearch, ShowStaffCredit, SwitchToMirrorMode)
+    - Fixed `onDeleteRender(this)` bug in 3 files (`this` is undefined in functional components)
+    - Replaced PropTypes with TypeScript `Props` type in all subscribers
+    - Removed unnecessary `React.memo` wrapper from CreatePage
+    - Unified return values: `return null` for logic-only components
+    - Converted all 6 subscribers from default exports to named exports
+  - Result: initial: 1,573 (+1) / async-only: 4,516 (-92) / total: 6,089 (-91) / compiled: 8,802 (-93)
+  - _Requirements: 4.1, 6.1_
+
 - [ ] 8.N Loop iteration N: (next iteration — measure, analyze, propose, implement)
 
 ## Phase 3: Next.js Version Upgrade Evaluation (Deferred)