mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-21 05:11:13 -05:00
Fix: Stabilize useAdminSettings dependencies
This commit is contained in:
@@ -806,21 +806,26 @@ export function useModerationQueueManager(
|
||||
|
||||
// Visibility change handler
|
||||
useEffect(() => {
|
||||
console.log('🔍 [VISIBILITY EFFECT] Running', {
|
||||
settingsObject: settings,
|
||||
// HARD CHECK: Explicit boolean comparison to prevent any truthy coercion
|
||||
const isEnabled = settings.refreshOnTabVisible === true;
|
||||
|
||||
console.log('🔍 [VISIBILITY EFFECT] Hard check', {
|
||||
refreshOnTabVisible: settings.refreshOnTabVisible,
|
||||
typeOf: typeof settings.refreshOnTabVisible,
|
||||
rawValue: JSON.stringify(settings.refreshOnTabVisible),
|
||||
stringValue: String(settings.refreshOnTabVisible),
|
||||
boolValue: Boolean(settings.refreshOnTabVisible),
|
||||
isEnabled,
|
||||
willAttachListener: isEnabled,
|
||||
timestamp: new Date().toISOString()
|
||||
});
|
||||
|
||||
// Early return if feature is disabled
|
||||
if (!settings.refreshOnTabVisible) {
|
||||
console.log(' ✅ Setting is FALSE - NO listener will be attached');
|
||||
if (!isEnabled) {
|
||||
console.log(' ✅ Feature DISABLED - skipping all visibility logic');
|
||||
console.log(' ✅ Tab focus will NOT trigger refreshes');
|
||||
return;
|
||||
|
||||
// Cleanup: ensure no lingering handlers
|
||||
return () => {
|
||||
console.log(' 🧹 Cleanup: Ensuring no visibility listeners exist');
|
||||
};
|
||||
}
|
||||
|
||||
console.error(' ❌ Setting is TRUE - listener WILL be attached');
|
||||
|
||||
Reference in New Issue
Block a user