mirror of
https://github.com/supabase/supabase.git
synced 2026-10-09 03:15:06 +03:00
fix(og-generator): switching templates no longer resets the background pattern
changeTemplate() used to overwrite patternType/Scale/Opacity with the new template's defaultPattern on every switch. Template and background are meant to be independent controls, so it now only sets the template. AI suggestions are unaffected — applySuggestion() already sets the pattern separately, right after calling changeTemplate(), when the suggestion includes one. Verified: set pattern to vlines, switched template to centered (whose default is dots), pattern select stayed on vlines. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
463e88b160
commit
ed32f16fcd
1 file changed
+4
-6
@@ -439,14 +439,12 @@ export default function Page() {
|
||||
const og = useRenderedImage(ogEndpoint, showOg)
|
||||
const thumb = useRenderedImage(thumbEndpoint, showThumb)
|
||||
|
||||
// Template and background are independent controls — switching templates
|
||||
// must not touch whatever pattern the user already has set. (AI suggestions
|
||||
// still set a pattern explicitly, right after calling this, when the
|
||||
// suggestion includes one — see applySuggestion below.)
|
||||
const changeTemplate = (id: string) => {
|
||||
setTemplate(id)
|
||||
const t = TEMPLATES.find((x) => x.id === id)
|
||||
if (t) {
|
||||
setPatternType(t.defaultPattern.type as PatternTypeOpt)
|
||||
setPatternScale(normalizeScale(t.defaultPattern.scale as PatternScaleOpt))
|
||||
setPatternOpacity(Math.max(OPACITY_MIN, t.defaultPattern.opacity))
|
||||
}
|
||||
}
|
||||
|
||||
const [generated, setGenerated] = useState<Suggestion | null>(null)
|
||||
|
||||
Reference in new issue
Block a user