-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redux store #72
Redux store #72
Conversation
johncalesp
commented
May 11, 2023
- State management is handle by redux-store
- Changed unit testing
|
||
export default function Habitat({ habitatData }) { | ||
export default function Habitat() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function Habitat
has 66 lines of code (exceeds 25 allowed). Consider refactoring.
["RTX4000", 20.2342], | ||
]; | ||
|
||
const habitatData = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Identical blocks of code found in 2 locations. Consider refactoring.
@@ -32,11 +32,14 @@ import { loadJsonFiles } from "../utils/parsers"; | |||
|
|||
import { useSelector } from "react-redux"; | |||
|
|||
const ProviderPanel = ({ habitatData, cloudProviderURLs }) => { | |||
const ProviderPanel = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ProviderPanel
has 346 lines of code (exceeds 25 allowed). Consider refactoring.
|
||
const { ResizeObserver } = window; | ||
|
||
const data = { | ||
const habitatData = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Identical blocks of code found in 2 locations. Consider refactoring.
["RTX4000", 20.2342], | ||
["demo", 1], | ||
]; | ||
const noHabitatData = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Identical blocks of code found in 2 locations. Consider refactoring.
Can you add more details on what you moved to Redux and what each reducer is responsible for? |
* @returns The VSCode API handle | ||
*/ | ||
function acquireApi() { | ||
// if (typeof this.acquireApi.api == 'undefined') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it
export default function Habitat({ habitatData }) { | ||
export default function Habitat() { | ||
const {analysisState} = useSelector((state) => state.analysisStateSliceReducer); | ||
const habitatData = analysisState["habitat"]; | ||
const habitatIsDemo = habitatData.predictions?.find( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be put in the redux state
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I refactored that part
I think this is a good start for us to use Redux. Did you have a way to separate what states should be in the store vs stored locally? If we can keep that consistent, then it would be better to maintain longterm |
export default function Habitat({ habitatData }) { | ||
const habitatIsDemo = habitatData.predictions?.find( | ||
(item) => item[0] === "demo" && item[1] === 1 | ||
export default function Habitat() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function Habitat
has 65 lines of code (exceeds 25 allowed). Consider refactoring.
@@ -21,11 +21,13 @@ import { energy_data, unitScale, numberFormat } from "../utils/utils"; | |||
|
|||
import { useSelector } from "react-redux"; | |||
|
|||
const EnergyConsumption = ({ energyData }) => { | |||
const EnergyConsumption = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function EnergyConsumption
has 281 lines of code (exceeds 25 allowed). Consider refactoring.
@@ -32,12 +32,16 @@ import { loadJsonFiles } from "../utils/parsers"; | |||
|
|||
import { useSelector } from "react-redux"; | |||
|
|||
const ProviderPanel = ({ habitatData, cloudProviderURLs }) => { | |||
const ProviderPanel = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ProviderPanel
has 348 lines of code (exceeds 25 allowed). Consider refactoring.
|
||
const WelcomeScreen = ({ analysisState, vscodeApi }) => { | ||
const WelcomeScreen = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function WelcomeScreen
has 38 lines of code (exceeds 25 allowed). Consider refactoring.
@@ -9,10 +9,12 @@ import { numberFormat } from "../utils/utils"; | |||
|
|||
import { useSelector } from "react-redux"; | |||
|
|||
const DeploymentTab = ({ habitatData,cloudProviderURLs }) => { | |||
const DeploymentTab = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function DeploymentTab
has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Code Climate has analyzed commit f8c482b and detected 11 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
I added more comments in redux/store/store.js to indicate the responsibilities of each slice. |