Skip to content

feat: add setSettings overload accepting an update function - #169

Open
GeekyEggo wants to merge 5 commits into
v3from
set-settings-from-func
Open

feat: add setSettings overload accepting an update function#169
GeekyEggo wants to merge 5 commits into
v3from
set-settings-from-func

Conversation

@GeekyEggo

Copy link
Copy Markdown
Member

Summary

Adds a new overload to setSettings that accepts an update function, allowing settings to be modified based on the current value.

Changes

  • Added setSettings(update: (current: TSettings) => Promise<TSettings> | TSettings) overload to ActionBase
  • The update function receives the current settings and returns the new settings (sync or async)
  • Added tests for the new functionality including sync/async update functions and cache invalidation

@changeset-bot

changeset-bot Bot commented Aug 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 28e65c8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@elgato/utils Patch
@elgato/streamdeck Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds functional settings updates to ActionBase.

Changes:

  • Supports synchronous and asynchronous updater functions.
  • Adds updater and cache-invalidation tests.
  • Expands controller type assertions.

Reviewed changes

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

File Description
action-base.ts Adds the setSettings updater overload.
action.test.ts Tests updater behavior and type assertions.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +132 to +133
const payload =
typeof settingsOrUpdate === "function" ? await settingsOrUpdate(await this.getSettings()) : settingsOrUpdate;
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