debug icon indicating copy to clipboard operation
debug copied to clipboard

Why cache namespaces?

Open OldStarchy opened this issue 1 year ago • 0 comments

I do not understand why localstorage is used to cache the enabled namespaces. It seems to just cause confusion with unexpected behavior. #901 #536 #871 #534 #337

I had to spend some time to figure out why

if (process.env.VITE_DEBUG_ENABLE)
    debug.enable(process.env.VITE_DEBUG_ENABLE);

didn't work when I removed the env var. I expected each page load to be an isolated environment until I managed to step through the code and see its caching. I tried to disable storage with debug.store = null but that didn't prevent the initial load.

debug.enable(process.env.VITE_DEBUG_ENABLE ?? '');

is where I landed, which admittedly isn't complicated, but its weird that I had to deal with this problem.

OldStarchy avatar Oct 10 '24 01:10 OldStarchy