From 9ce1a97f06fa46c95777950377247ace274bb836 Mon Sep 17 00:00:00 2001 From: Andrew Hoang Date: Mon, 27 Jul 2026 09:53:37 +0700 Subject: [PATCH] fix: prevent effect restarts when options are unchanged --- src/lib/Asciify/AsciifyVanilla.ts | 6 ++++++ src/lib/Bend/BendVanilla.ts | 6 ++++++ src/lib/Blaze/BlazeVanilla.ts | 6 ++++++ src/lib/Bubble/BubbleVanilla.ts | 6 ++++++ src/lib/Cloth/ClothVanilla.ts | 6 ++++++ src/lib/Clouds/CloudsVanilla.ts | 6 ++++++ src/lib/Droplets/DropletsVanilla.ts | 6 ++++++ src/lib/Frost/FrostVanilla.ts | 6 ++++++ src/lib/Glass/GlassVanilla.ts | 6 ++++++ src/lib/Glitch/GlitchVanilla.ts | 6 ++++++ src/lib/Grid/GridVanilla.ts | 6 ++++++ src/lib/HexFloat/HexFloatVanilla.ts | 6 ++++++ src/lib/Laser/LaserVanilla.ts | 6 ++++++ src/lib/Liquid/LiquidVanilla.ts | 6 ++++++ src/lib/Magnify/MagnifyVanilla.ts | 6 ++++++ src/lib/ParticleReveal/ParticleRevealVanilla.ts | 7 +++++++ src/lib/ParticleScroll/ParticleScrollVanilla.ts | 7 +++++++ src/lib/Peel/PeelVanilla.ts | 6 ++++++ src/lib/RetroDither/RetroDitherVanilla.ts | 6 ++++++ src/lib/Ripple/RippleVanilla.ts | 6 ++++++ src/lib/Shatter/ShatterVanilla.ts | 6 ++++++ src/lib/VHS/VHSVanilla.ts | 6 ++++++ 22 files changed, 134 insertions(+) diff --git a/src/lib/Asciify/AsciifyVanilla.ts b/src/lib/Asciify/AsciifyVanilla.ts index 9ca29fc..92ff2ef 100644 --- a/src/lib/Asciify/AsciifyVanilla.ts +++ b/src/lib/Asciify/AsciifyVanilla.ts @@ -994,6 +994,12 @@ function initializeAsciify( return { setOptions(next) { + if ( + !Object.entries(next).some( + ([key, value]) => config[key as keyof AsciifyOptions] !== value, + ) + ) + return; Object.assign(config, next); syncBacking(); start(); diff --git a/src/lib/Bend/BendVanilla.ts b/src/lib/Bend/BendVanilla.ts index 5460898..e3eedd4 100644 --- a/src/lib/Bend/BendVanilla.ts +++ b/src/lib/Bend/BendVanilla.ts @@ -916,6 +916,12 @@ export function createBend( return { setOptions(next) { + if ( + !Object.entries(next).some( + ([key, value]) => config[key as keyof BendOptions] !== value, + ) + ) + return; Object.assign(config, next); syncScroll(); start(); diff --git a/src/lib/Blaze/BlazeVanilla.ts b/src/lib/Blaze/BlazeVanilla.ts index f19ee66..09d2c14 100644 --- a/src/lib/Blaze/BlazeVanilla.ts +++ b/src/lib/Blaze/BlazeVanilla.ts @@ -644,6 +644,12 @@ export function createBlaze( return { setOptions(next) { + if ( + !Object.entries(next).some( + ([key, value]) => config[key as keyof BlazeOptions] !== value, + ) + ) + return; Object.assign(config, next); start(); }, diff --git a/src/lib/Bubble/BubbleVanilla.ts b/src/lib/Bubble/BubbleVanilla.ts index ceff051..0ba435d 100644 --- a/src/lib/Bubble/BubbleVanilla.ts +++ b/src/lib/Bubble/BubbleVanilla.ts @@ -611,6 +611,12 @@ export function createBubble( return { setOptions(next) { + if ( + !Object.entries(next).some( + ([key, value]) => config[key as keyof BubbleOptions] !== value, + ) + ) + return; Object.assign(config, next); start(); }, diff --git a/src/lib/Cloth/ClothVanilla.ts b/src/lib/Cloth/ClothVanilla.ts index 481ce15..b3482d7 100644 --- a/src/lib/Cloth/ClothVanilla.ts +++ b/src/lib/Cloth/ClothVanilla.ts @@ -849,6 +849,12 @@ export function createCloth( return { setOptions(next) { + if ( + !Object.entries(next).some( + ([key, value]) => config[key as keyof ClothOptions] !== value, + ) + ) + return; Object.assign(config, next); syncBacking(); start(); diff --git a/src/lib/Clouds/CloudsVanilla.ts b/src/lib/Clouds/CloudsVanilla.ts index 457a9cf..cd48ec7 100644 --- a/src/lib/Clouds/CloudsVanilla.ts +++ b/src/lib/Clouds/CloudsVanilla.ts @@ -734,6 +734,12 @@ export function createClouds( return { setOptions(next) { + if ( + !Object.entries(next).some( + ([key, value]) => config[key as keyof CloudsOptions] !== value, + ) + ) + return; Object.assign(config, next); syncCanvasSize(); syncBaseColor(); diff --git a/src/lib/Droplets/DropletsVanilla.ts b/src/lib/Droplets/DropletsVanilla.ts index a946d6f..b3b3b2a 100644 --- a/src/lib/Droplets/DropletsVanilla.ts +++ b/src/lib/Droplets/DropletsVanilla.ts @@ -705,6 +705,12 @@ export function createDroplets( return { setOptions(next) { + if ( + !Object.entries(next).some( + ([key, value]) => config[key as keyof DropletsOptions] !== value, + ) + ) + return; Object.assign(config, next); start(); }, diff --git a/src/lib/Frost/FrostVanilla.ts b/src/lib/Frost/FrostVanilla.ts index 81c52d7..a18942b 100644 --- a/src/lib/Frost/FrostVanilla.ts +++ b/src/lib/Frost/FrostVanilla.ts @@ -1129,6 +1129,12 @@ export function createFrost( start(); }, setOptions(next) { + if ( + !Object.entries(next).some( + ([key, value]) => config[key as keyof FrostOptions] !== value, + ) + ) + return; const { quality, ...rest } = next; const qualityChanged = quality !== undefined && quality !== config.quality; diff --git a/src/lib/Glass/GlassVanilla.ts b/src/lib/Glass/GlassVanilla.ts index 6eaaf13..83c7dff 100644 --- a/src/lib/Glass/GlassVanilla.ts +++ b/src/lib/Glass/GlassVanilla.ts @@ -584,6 +584,12 @@ export function createGlass( return { setOptions(next) { + if ( + !Object.entries(next).some( + ([key, value]) => config[key as keyof GlassOptions] !== value, + ) + ) + return; Object.assign(config, next); start(); }, diff --git a/src/lib/Glitch/GlitchVanilla.ts b/src/lib/Glitch/GlitchVanilla.ts index 726d278..54fffa1 100644 --- a/src/lib/Glitch/GlitchVanilla.ts +++ b/src/lib/Glitch/GlitchVanilla.ts @@ -395,6 +395,12 @@ export function createGlitch( return { setOptions(next) { + if ( + !Object.entries(next).some( + ([key, value]) => config[key as keyof GlitchOptions] !== value, + ) + ) + return; Object.assign(config, next); start(); }, diff --git a/src/lib/Grid/GridVanilla.ts b/src/lib/Grid/GridVanilla.ts index 31b19ab..8407969 100644 --- a/src/lib/Grid/GridVanilla.ts +++ b/src/lib/Grid/GridVanilla.ts @@ -764,6 +764,12 @@ export function createGrid( return { setOptions(next) { + if ( + !Object.entries(next).some( + ([key, value]) => config[key as keyof GridOptions] !== value, + ) + ) + return; Object.assign(config, next); start(); }, diff --git a/src/lib/HexFloat/HexFloatVanilla.ts b/src/lib/HexFloat/HexFloatVanilla.ts index 409e716..fed1fbf 100644 --- a/src/lib/HexFloat/HexFloatVanilla.ts +++ b/src/lib/HexFloat/HexFloatVanilla.ts @@ -1580,6 +1580,12 @@ export function createHexFloat( return { setOptions(next) { + if ( + !Object.entries(next).some( + ([key, value]) => config[key as keyof HexFloatOptions] !== value, + ) + ) + return; Object.assign(config, next); start(); }, diff --git a/src/lib/Laser/LaserVanilla.ts b/src/lib/Laser/LaserVanilla.ts index fc11cab..76c5829 100644 --- a/src/lib/Laser/LaserVanilla.ts +++ b/src/lib/Laser/LaserVanilla.ts @@ -616,6 +616,12 @@ export function createLaser( return { setOptions(next) { + if ( + !Object.entries(next).some( + ([key, value]) => config[key as keyof LaserOptions] !== value, + ) + ) + return; Object.assign(config, next); start(); }, diff --git a/src/lib/Liquid/LiquidVanilla.ts b/src/lib/Liquid/LiquidVanilla.ts index 498e700..36476b1 100644 --- a/src/lib/Liquid/LiquidVanilla.ts +++ b/src/lib/Liquid/LiquidVanilla.ts @@ -861,6 +861,12 @@ export function createLiquid( start(); }, setOptions(next) { + if ( + !Object.entries(next).some( + ([key, value]) => config[key as keyof LiquidOptions] !== value, + ) + ) + return; const { simResolution, dyeResolution, ...rest } = next; void simResolution; void dyeResolution; diff --git a/src/lib/Magnify/MagnifyVanilla.ts b/src/lib/Magnify/MagnifyVanilla.ts index c4bc3fd..537773a 100644 --- a/src/lib/Magnify/MagnifyVanilla.ts +++ b/src/lib/Magnify/MagnifyVanilla.ts @@ -732,6 +732,12 @@ export function createMagnify( return { setOptions(next) { + if ( + !Object.entries(next).some( + ([key, value]) => config[key as keyof MagnifyOptions] !== value, + ) + ) + return; const previousZoom = config.zoom; Object.assign(config, next); if (!config.scrollZoom || config.zoom !== previousZoom) { diff --git a/src/lib/ParticleReveal/ParticleRevealVanilla.ts b/src/lib/ParticleReveal/ParticleRevealVanilla.ts index 243d8eb..4818b40 100644 --- a/src/lib/ParticleReveal/ParticleRevealVanilla.ts +++ b/src/lib/ParticleReveal/ParticleRevealVanilla.ts @@ -486,6 +486,13 @@ export function createParticleReveal( return { setOptions(next) { + if ( + !Object.entries(next).some( + ([key, value]) => + config[key as keyof ParticleRevealOptions] !== value, + ) + ) + return; Object.assign(config, next); start(); }, diff --git a/src/lib/ParticleScroll/ParticleScrollVanilla.ts b/src/lib/ParticleScroll/ParticleScrollVanilla.ts index d6e6344..4618682 100644 --- a/src/lib/ParticleScroll/ParticleScrollVanilla.ts +++ b/src/lib/ParticleScroll/ParticleScrollVanilla.ts @@ -663,6 +663,13 @@ export function createParticleScroll( return { setOptions(next) { + if ( + !Object.entries(next).some( + ([key, value]) => + config[key as keyof ParticleScrollOptions] !== value, + ) + ) + return; Object.assign(config, next); start(); }, diff --git a/src/lib/Peel/PeelVanilla.ts b/src/lib/Peel/PeelVanilla.ts index b693a76..a58b2d4 100644 --- a/src/lib/Peel/PeelVanilla.ts +++ b/src/lib/Peel/PeelVanilla.ts @@ -588,6 +588,12 @@ export function createPeel( return { setOptions(next) { + if ( + !Object.entries(next).some( + ([key, value]) => config[key as keyof PeelOptions] !== value, + ) + ) + return; Object.assign(config, next); syncShineColor(); start(); diff --git a/src/lib/RetroDither/RetroDitherVanilla.ts b/src/lib/RetroDither/RetroDitherVanilla.ts index 08f5c16..34f560b 100644 --- a/src/lib/RetroDither/RetroDitherVanilla.ts +++ b/src/lib/RetroDither/RetroDitherVanilla.ts @@ -437,6 +437,12 @@ export function createRetroDither( return { setOptions(next) { + if ( + !Object.entries(next).some( + ([key, value]) => config[key as keyof RetroDitherOptions] !== value, + ) + ) + return; Object.assign(config, next); start(); }, diff --git a/src/lib/Ripple/RippleVanilla.ts b/src/lib/Ripple/RippleVanilla.ts index 6435e2e..5cc6d8f 100644 --- a/src/lib/Ripple/RippleVanilla.ts +++ b/src/lib/Ripple/RippleVanilla.ts @@ -475,6 +475,12 @@ export function createRipple( return { setOptions(next) { + if ( + !Object.entries(next).some( + ([key, value]) => config[key as keyof RippleOptions] !== value, + ) + ) + return; Object.assign(config, next); start(); }, diff --git a/src/lib/Shatter/ShatterVanilla.ts b/src/lib/Shatter/ShatterVanilla.ts index b4a3a07..3a66962 100644 --- a/src/lib/Shatter/ShatterVanilla.ts +++ b/src/lib/Shatter/ShatterVanilla.ts @@ -675,6 +675,12 @@ export function createShatter( return { setOptions(next) { + if ( + !Object.entries(next).some( + ([key, value]) => config[key as keyof ShatterOptions] !== value, + ) + ) + return; Object.assign(config, next); start(); }, diff --git a/src/lib/VHS/VHSVanilla.ts b/src/lib/VHS/VHSVanilla.ts index 3091d6e..1987645 100644 --- a/src/lib/VHS/VHSVanilla.ts +++ b/src/lib/VHS/VHSVanilla.ts @@ -521,6 +521,12 @@ export function createVHS( return { setOptions(next) { + if ( + !Object.entries(next).some( + ([key, value]) => config[key as keyof VHSOptions] !== value, + ) + ) + return; Object.assign(config, next); start(); },