Skip to content

fix: apply env QR presets on initial page load#287

Open
aleex1848 wants to merge 1 commit into
lyqht:mainfrom
hwkdo:fix/apply-env-preset-on-load
Open

fix: apply env QR presets on initial page load#287
aleex1848 wants to merge 1 commit into
lyqht:mainfrom
hwkdo:fix/apply-env-preset-on-load

Conversation

@aleex1848
Copy link
Copy Markdown

Summary

  • Apply VITE_QR_CODE_PRESETS (and embedded frame on presets) on first page load, not only after manual config import or preset change.
  • Run selectedPreset watcher with { immediate: true } via applySelectedPresetToState().
  • Stop the frame preset watcher from overwriting QR preset frame styles on init (removed immediate: true).

Problem

When self-hosting with env-defined presets, logo/colors/frame were wrong on first visit but correct after loading a JSON config or switching presets.

Test plan

  • Build with a custom entry in VITE_QR_CODE_PRESETS (logo + colors).
  • Open app in a fresh session / incognito — preview matches preset without manual import.
  • If preset includes frame, frame styles apply on first load.
  • Changing preset in UI still updates QR style.
  • Local storage / loaded-from-file presets still work.

Presets from VITE_QR_CODE_PRESETS were not applied on first visit because
the selectedPreset watcher did not run immediately. The frame preset watcher
also overwrote frame styles from the QR preset when run with immediate: true.
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 29, 2026

@aleex1848 is attempting to deploy a commit to the lyqht's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

1 participant