GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — refactor: settings store の 11 setter を makeSetter factory で集約 (#271) by ymnao · Pull Request #273 · ymnao/scripta

Conversation

@ymnao

@ymnao ymnao commented Jul 1, 2026

Copy link
Copy Markdown
Owner

概要

src/stores/settings.ts に定義された 11 個の setter (setShowLineNumbers / setFontSize / setAutoSaveDelay / setHighlightActiveLine / setFontFamily / setTrimTrailingWhitespace / setShowLinkCards / setScratchpadVolatile / setAutoUpdateCheck / setFileTreeShowHidden / setFileTreeExcludePatterns) が全て同一 3 行 pattern (void saveXxx(val); set({key: val});) だったため、create() 内 closure factory makeSetter<K extends keyof SettingsValues> を定義し 11 setter を 1 行呼び出しに置換。

関連 Issue

Closes #271

移行 Stage

Stage 分類外(Electron 化完了後の内部品質改善)。

変更内容

  • src/stores/settings.ts に create() 内 closure factory makeSetter<K extends keyof SettingsValues>(key, save) を追加
  • 11 setter を factory 呼び出し(1 行)に置換
  • 外部 API は完全に一致(呼び出し側コンポーネント / hook / test に変更なし)
  • generic factory で key と value の型対応を静的保証(tsc で wrong-variable copy-paste 検出可能)
  • Diff: 1 file / +36 -60(net -24 行)

動作確認

  • biome check clean
  • typecheck 3 config (web / node / e2e) clean
  • vitest 2230 pass / 2 skipped
  • src/stores/settings.test.ts 14 pass
  • /code-review low: (none)
  • /simplify pass 1(4 reviewer): 本 PR scope 内は (none)
  • /code-review medium(8 finder): all [](correctness / cleanup / conventions 違反なし)

検討事項

/simplify の Reuse / Altitude reviewer が「makeSetter を src/lib/store-helpers.ts に hoist して git-sync.ts の 7 setter と共通化」を指摘(HANDOFF 49 ★「次 PR で 2 箇所目が発生したら helper 化」基準成立)。本 PR は user 明示採択 scope(settings.ts 1 file)から逸脱するため対応せず、follow-up issue #272 を起票済(次 PR で makePersistedSetter<TValues, K> を generic hoist + git-sync.ts の setCommitMessage 用 normalize? optional transform を追加予定)。

スクリーンショット

UI 変更なし。

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ymnao
refactor: settings store の 11 setter を makeSetter factory で集約 (#271)
da3d804
src/stores/settings.ts で 11 個の setter (setShowLineNumbers /
setFontSize / setAutoSaveDelay / setHighlightActiveLine / setFontFamily /
setTrimTrailingWhitespace / setShowLinkCards / setScratchpadVolatile /
setAutoUpdateCheck / setFileTreeShowHidden / setFileTreeExcludePatterns)
が全て同一 3 行 pattern (void saveXxx(val) + set({key: val})) だったため、
create() 内 closure factory `makeSetter<K extends keyof SettingsValues>` を
定義し 11 setter を 1 行呼び出しに置換。

- generic factory で key と value 型の対応を静的保証 (tsc で wrong-variable
  copy-paste を検出可能)
- scope は file-private (create() 内 closure)
- 挙動同一 (void save() → set({key: value}) の順序と semantics 維持)
- vitest 2230 pass / 2 skipped, settings.test.ts 14 pass, biome/typecheck clean

Closes #271
@ymnao
ymnao merged commit b9829a2 into main Jul 1, 2026
9 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@ymnao
ymnao deleted the refactor/settings-setter-factory-#271 branch July 1, 2026 13:41
@ymnao ymnao mentioned this pull request Jul 5, 2026
chore: v0.7.0 リリース準備 #281
Merged
6 of 7 tasks
ymnao added a commit that referenced this pull request Jul 5, 2026
@ymnao @claude
chore: v0.7.0 リリース準備 (#281)
9bce21d
- package.json の version を 0.6.0 → 0.7.0 に bump
- CHANGELOG.md に v0.7.0 エントリを追加 (#243 〜 #280)
  - Fixed: FileTree scroll regression (#276)、electron e2e launch teardown timeout 拡大 (#247)
  - Internal: #209 3 項目 (drift-lock 系 refactor #278/#279/#280)、settings setter 集約 (#273 → #277)、search/workspace/backlink 系 helper 抽出 15 件
  - Dependencies: electron 43.0.0 / p-limit 7.3.0 major bump (#275)、Dependabot 7 件 combine (#274)、pnpm-workspace.yaml overrides で @codemirror dual copy を恒久防止

Co-authored-by: Claude Opus 4.7 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

refactor: settings store の 11 setter を makeSetter factory で集約

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@ymnao
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.