perf(hooks): document stable reference optimization in useDefaultSubplebbits

This commit is contained in:
plebeius
2025-11-07 12:49:58 +01:00
parent f4856563df
commit e7e2a2fda7
+3 -1
View File
@@ -158,7 +158,9 @@ export const useDefaultSubplebbits = () => {
};
}, []);
// To maintain backward compatibility, return the subplebbits array directly
// Always prefer cacheSubplebbits (module-level, stable reference) when available
// Only use state.subplebbits during initial load before cache is populated
// This ensures a stable reference for memoization in consuming hooks
return cacheSubplebbits || state.subplebbits;
};