🧑‍💻 Enable debug tools on every environment

This commit is contained in:
Philipp Stracker 2025-01-28 18:27:42 +01:00
parent 585b24fe78
commit 1f3049e2eb
No known key found for this signature in database

View file

@ -6,13 +6,18 @@ import {
StylingStoreName, StylingStoreName,
TodosStoreName, TodosStoreName,
} from './index'; } from './index';
import { setCompleted } from './onboarding/actions';
export const addDebugTools = ( context, modules ) => { export const addDebugTools = ( context, modules ) => {
if ( ! context || ! context?.debug ) { if ( ! context ) {
return; return;
} }
/*
// TODO - enable this condition for version 3.0.1
// In version 3.0.0 we want to have the debug tools available on every installation
if ( ! context.debug ) { return }
*/
// Dump the current state of all our Redux stores. // Dump the current state of all our Redux stores.
context.dumpStore = async () => { context.dumpStore = async () => {
/* eslint-disable no-console */ /* eslint-disable no-console */
@ -70,8 +75,12 @@ export const addDebugTools = ( context, modules ) => {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log( `Reset store: ${ storeName }...` ); console.log( `Reset store: ${ storeName }...` );
store.reset(); try {
store.persist(); store.reset();
store.persist();
} catch ( error ) {
console.error( ' ... Reset failed, skipping this store' );
}
} ); } );
}; };