Skip to content

Commit af7f759

Browse files
committed
issue #2302 - Warnings in developer console (except of Warning: Formsy: isMounted is deprecated)
1 parent 742774d commit af7f759

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

src/components/Grid/GridView.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const GridView = props => {
1818
const headerProps = { columns, sortHandler, currentSortField }
1919

2020
const renderItem = (item, index) => {
21-
return item.isPlaceholder ? <Placeholder columns={columns} /> : <ListComponent columns={columns} item={item} key={index}/>
21+
return item.isPlaceholder ? <Placeholder columns={columns} key={`placeholder-${index}`} /> : <ListComponent columns={columns} item={item} key={item.id}/>
2222
}
2323

2424
const handleLoadMore = () => {

src/projects/detail/components/SpecSection.jsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,15 +196,15 @@ const SpecSection = props => {
196196
}
197197
case 'project-name': {
198198
const refCodeFieldName = 'details.utm.code'
199-
const refCode = _.get(project, refCodeFieldName, undefined)
199+
const refCode = _.get(project, refCodeFieldName, '')
200200
const queryParamRefCode = qs.parse(window.location.search).refCode
201201
return (
202202
<div className="project-name-section">
203203
<div className="editable-project-name">
204204
<TCFormFields.TextInput
205205
name="name"
206206
placeholder="Project Name"
207-
value={_.get(project, 'name', undefined)}
207+
value={_.get(project, 'name', '')}
208208
wrapperClass="project-name"
209209
maxLength={ PROJECT_NAME_MAX_LENGTH }
210210
required={props.required}
@@ -265,9 +265,9 @@ SpecSection.propTypes = {
265265
sectionNumber: PropTypes.number.isRequired,
266266
showHidden: PropTypes.bool,
267267
isCreation: PropTypes.bool,
268-
addAttachment: PropTypes.func.isRequired,
269-
updateAttachment: PropTypes.func.isRequired,
270-
removeAttachment: PropTypes.func.isRequired,
268+
addAttachment: PropTypes.func,
269+
updateAttachment: PropTypes.func,
270+
removeAttachment: PropTypes.func,
271271
}
272272

273273
export default scrollToAnchors(SpecSection)

src/projects/reducers/project.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ export const projectState = function (state=initialState, action) {
171171
case CLEAR_LOADED_PROJECT:
172172
case GET_PROJECTS_SUCCESS:
173173
return Object.assign({}, state, {
174+
isLoading: true, // this is excpected to be default value when there is not project loaded
174175
project: {},
175176
projectNonDirty: {},
176177
phases: null,

src/projects/reducers/projectDashboard.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
import {
33
LOAD_PROJECT_DASHBOARD_PENDING,
44
LOAD_PROJECT_DASHBOARD_SUCCESS,
5-
LOAD_PROJECT_DASHBOARD_FAILURE
5+
LOAD_PROJECT_DASHBOARD_FAILURE,
6+
CLEAR_LOADED_PROJECT,
7+
GET_PROJECTS_SUCCESS,
68
} from '../../config/constants'
79

810
const initialState = {
@@ -30,6 +32,14 @@ export const projectDashboard = function (state=initialState, action) {
3032
error: true
3133
})
3234

35+
// when we clear the project we have to put dashboard state to the initial state
36+
// because the code relies on the initial state
37+
// for example spinnerWhileLoading in ProjectDerail.jsx expects `isLoading` to be true
38+
// to prevent components which require dashboard data from rendering
39+
case CLEAR_LOADED_PROJECT:
40+
case GET_PROJECTS_SUCCESS:
41+
return Object.assign({}, state, initialState)
42+
3343
default:
3444
return state
3545
}

0 commit comments

Comments
 (0)