Skip to content

feat(config): add region and storefront persistence#11

Merged
flexiondotorg merged 4 commits intomainfrom
storefront
Mar 21, 2026
Merged

feat(config): add region and storefront persistence#11
flexiondotorg merged 4 commits intomainfrom
storefront

Conversation

@flexiondotorg
Copy link
Copy Markdown
Member

Description

  • Add electron-store dependency for persistent storage
  • Create config.ts with typed store wrapper for storefront and language
  • Detect region from OS locale with fallback to 'us'
  • Build Apple Music URL with three-tier fallback: persisted storefront, OS region, default
  • Append language parameter to URL when persisted
  • Listen for navigation events and update store on storefront changes
  • Avoid disk I/O churn by only writing when values change
  • Update documentation with region/storefront features

Closes #7

Checklist

  • I have performed a self-review of my code
  • I have tested my changes and confirmed there are no regressions

- Add electron-store dependency for persistent storage
- Create config.ts with typed store wrapper for storefront and language
- Detect region from OS locale with fallback to 'us'
- Build Apple Music URL with three-tier fallback: persisted storefront,
  OS region, default
- Append language parameter to URL when persisted
- Listen for navigation events and update store on storefront changes
- Avoid disk I/O churn by only writing when values change
- Update documentation with region/storefront features

Signed-off-by: Martin Wimpress <code@wimpress.io>
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 8 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="AGENTS.md">

<violation number="1" location="AGENTS.md:128">
P2: This documentation line is inaccurate: `LOADING_TEXT` is not the only translation surface, and the language count is outdated. It can mislead future contributors into updating only one record and leaving UI strings inconsistent.</violation>
</file>

<file name="src/main.ts">

<violation number="1" location="src/main.ts:104">
P2: Do not overwrite persisted language with `null` when navigation URL omits `?l=`; this unintentionally clears the saved language preference.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Add regex validation to ensure storefront codes match exactly two
lowercase letters. Prevents garbage values like 'includes' from being
persisted when Apple Music navigates to internal paths.

Signed-off-by: Martin Wimpress <code@wimpress.io>
- Add all 7 translation records to AGENTS.md contributor guidance
- Fix null assignment in language persistence logic: result.language now
  falls back to currentLanguage instead of always writing null when ?l=
  parameter is absent, preventing silent clearing of user preference
- Write storefront and language to storage only when values change

Signed-off-by: Martin Wimpress <code@wimpress.io>
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 2 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/main.ts">

<violation number="1" location="src/main.ts:106">
P2: Falling back to `currentLanguage` here makes language overrides sticky: URLs without `?l=` cannot clear a previously persisted language.</violation>
</file>

<file name="AGENTS.md">

<violation number="1" location="AGENTS.md:128">
P3: The new translation guidance has an incorrect language count (`31`), which now conflicts with `src/i18n.ts` (33 entries per record). Update the count to prevent contributors from following stale i18n docs.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Signed-off-by: Martin Wimpress <code@wimpress.io>
@flexiondotorg flexiondotorg merged commit d3295f0 into main Mar 21, 2026
11 checks passed
@flexiondotorg flexiondotorg deleted the storefront branch March 21, 2026 19:07
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.

Remember regional settings on startup

1 participant