Skip to content

Fix: [Section] Scalable Application Structure - #335

Closed
Ghostofcaldera wants to merge 1 commit into
piotrwitek:masterfrom
Ghostofcaldera:fix/issue-42-1781376321
Closed

Fix: [Section] Scalable Application Structure#335
Ghostofcaldera wants to merge 1 commit into
piotrwitek:masterfrom
Ghostofcaldera:fix/issue-42-1781376321

Conversation

@Ghostofcaldera

Copy link
Copy Markdown

Fixes #42

This PR addresses the IssueHunt-funded issue #42.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new documentation file outlining a scalable, feature-based directory structure and architecture for React and Redux applications. The reviewer provided valuable feedback to improve the code examples, including initializing the dynamic reducer configuration with a core placeholder reducer to prevent runtime errors when all optional features are disabled, and adding a missing import statement for configureStore in one of the example snippets.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +101 to +109
const featureReducers: Record<string, any> = {};

if (ENABLE_AUTH) {
featureReducers.auth = authReducer;
}

if (ENABLE_DASHBOARD) {
featureReducers.dashboard = dashboardReducer;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

If both ENABLE_AUTH and ENABLE_DASHBOARD are set to false, featureReducers will be an empty object {}. Passing an empty object to configureStore will cause Redux's combineReducers to throw a runtime error (e.g., "Store does not have a valid reducer").

To prevent this, you should initialize featureReducers with a core/static reducer or a placeholder reducer so that the store always has at least one valid reducer.

Suggested change
const featureReducers: Record<string, any> = {};
if (ENABLE_AUTH) {
featureReducers.auth = authReducer;
}
if (ENABLE_DASHBOARD) {
featureReducers.dashboard = dashboardReducer;
}
const featureReducers: Record<string, any> = {
_core: (state = {}) => state,
};
if (ENABLE_AUTH) {
featureReducers.auth = authReducer;
}
if (ENABLE_DASHBOARD) {
featureReducers.dashboard = dashboardReducer;
}

Comment on lines +132 to +138
import { authReducer, useAuth } from '@myapp/auth-feature';

const store = configureStore({
reducer: {
auth: authReducer,
},
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The code snippet uses configureStore but does not import it. To make the example complete and copy-pasteable, please add the import statement for configureStore from @reduxjs/toolkit.

Suggested change
import { authReducer, useAuth } from '@myapp/auth-feature';
const store = configureStore({
reducer: {
auth: authReducer,
},
});
import { configureStore } from '@reduxjs/toolkit';
import { authReducer, useAuth } from '@myapp/auth-feature';
const store = configureStore({
reducer: {
auth: authReducer,
},
});

@Ghostofcaldera

Copy link
Copy Markdown
Author

Hi @piotrwitek, this PR is ready for review and addresses an IssueHunt bounty. Please review and merge when you have a moment. Thank you!

@Ghostofcaldera

Copy link
Copy Markdown
Author

Closing as duplicate. The latest fix is in PR #338. Apologies for the noise — improving the automation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Section] Scalable Application Structure

1 participant