google / google/site-kit-wp

Extend `createSettingsStore()` to allow multiple usage within a module.

Open
#8,285 2 comments 1 reaction 0 assignees View on GitHub
P2 Type: Enhancement
Dominant language
JavaScript
Stars
1.4k
Forks
383
Avg merge
4d 14h
Merged PRs (30d)
77

Description

## Feature Description

At the moment `createSettingsStore()` can only be used once within the scope of a module, due to its hardwired names e.g. `getSettings()`.

It would be useful to be able to provide an additional identifier to distinguish the generated Redux infrastructure, so as to allow `createSettingsStore()` to be used for other types of settings within a module e.g. user settings, additional site settings such as Consent Mode, etc. This would allow us to cut down on boilerplate Redux when introducing new non-module settings.

So, for example we could provide an identifier like `consentMode` and the resulting selector would be `getConsentModeSettings()`.

---------------

_Do not alter or remove anything below. The following sections will be managed by moderators only._

## Acceptance criteria

*

## Implementation Brief

* [ ]

### Test Coverage

*

## QA Brief

*

## Changelog entry

*

Contributor guide

Open the contributing guide

Research direction

Start by locating createSettingsStore() and the existing getSettings() selector generation. Trace how the generated Redux infrastructure is named, then determine how an identifier such as consentMode should produce distinct selectors and avoid collisions. Done means multiple stores can coexist within one module, with tests covering the separate settings usages.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, redux
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.