Debugging
Reheaven includes debug warnings to help catch common mistakes while developing.
Debug warnings are there to catch suspicious usage before it becomes harder to track down.
Debug Warnings
Debug warnings are enabled by default.
You can disable them if needed:
Reheaven.setDebugWarning(false)
Most projects should keep warnings enabled during development.
Watching the Wrong Value
watch expects a signal or computed getter.
Reheaven.watch(function()
return 50
end, function(value)
print(value)
end)
This is suspicious because the getter does not come from Reheaven.
Use a real signal or computed value instead:
local coins, setCoins = Reheaven.signal(100)
Reheaven.watch(coins, function(value)
print(value)
end)
Adding the Wrong Cleanup
scope can clean up Roblox objects and cleanup functions.
Reheaven.scope(function(add)
add(part)
add(connection)
add(thread)
end)
But add should not receive random values.
Reheaven.scope(function(add)
add(50)
add("hello")
end)
Adding a Getter to Scope
A signal or computed getter is not a cleanup.
local coins, setCoins = Reheaven.signal(100)
Reheaven.scope(function(add)
add(coins)
end)
Reheaven warns because coins is a getter, not something that should be disposed.
Duplicate Cleanup
If something is already tracked by a scope, do not add it again.
Reheaven.scope(function(add)
local stop = Reheaven.effect(function()
print("Running")
end)
add(stop)
end)
Effects created inside a scope are already tracked automatically.
Circular Computeds
A computed value should not depend on itself.
local value
value = Reheaven.computed(function()
return value() + 1
end)
print(value()) -- should error
This creates a circular dependency and will error.
Signal Self-Writes Inside Effects
An effect should usually avoid reading and updating the same signal in the same run.
local coins, setCoins = Reheaven.signal(0)
Reheaven.effect(function()
setCoins(coins() + 1)
end)
This is suspicious because coins() is read inside the effect, then setCoins updates that same signal.
Reheaven skips rerunning the same effect to prevent accidental recursion, and shows a debug warning.
Use an updater function instead:
local coins, setCoins = Reheaven.signal(0)
Reheaven.effect(function()
setCoins(function(current)
return current + 1
end)
end)
Or use peek if you need to read without tracking:
local coins, setCoins = Reheaven.signal(0)
Reheaven.effect(function()
setCoins(Reheaven.peek(coins) + 1)
end)
Final Advice
Keep debug warnings enabled while building.
They are especially useful when working with scopes, watchers, and larger reactive systems.