Skip to content

[Refactor] ボタンのテキストによるアクション判定を状態変数で管理する #10

@ryoupr

Description

@ryoupr

問題

popup.jstoggleRefresh() でボタンのテキスト ('開始' か否か) でstart/stopアクションを判定している。UIの文言変更でバグになるリスクがある。

// 現状(脆弱)
const currentAction = toggleButton.textContent === '開始' ? 'start' : 'stop';

対応方針

状態変数 isRunningpopup.js 側でも持ち、テキストではなく変数でアクションを判定する。

// 改善案
const currentAction = isRunning ? 'stop' : 'start';

checkConnectionAndGetStatus() の戻り値で isRunning を更新し、UIとロジックを分離する。

優先度

🟡 中(保守性の改善)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions