aboutsummaryrefslogtreecommitdiff
path: root/src/client/react/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/react/components')
-rw-r--r--src/client/react/components/container/View.js18
-rw-r--r--src/client/react/components/page/User.js3
2 files changed, 12 insertions, 9 deletions
diff --git a/src/client/react/components/container/View.js b/src/client/react/components/container/View.js
index 9bac66f..be550cd 100644
--- a/src/client/react/components/container/View.js
+++ b/src/client/react/components/container/View.js
@@ -16,24 +16,26 @@ function cleanMeetingpointHTML(htmlStr) {
class View extends React.Component {
componentDidMount() {
- if (!this.loadingFinished(this.props.user)) {
- this.props.dispatch(fetchSchedule(this.props.user));
+ if (!this.loadingFinished(this.props.user, this.props.week)) {
+ this.props.dispatch(fetchSchedule(this.props.user, this.props.week));
}
}
componentWillReceiveProps(nextProps) {
- if (nextProps.user !== this.props.user && !this.loadingFinished(nextProps.user)) {
- this.props.dispatch(fetchSchedule(nextProps.user));
+ if ((nextProps.user !== this.props.user || nextProps.week !== this.props.week)
+ && !this.loadingFinished(nextProps.user, nextProps.week)) {
+ this.props.dispatch(fetchSchedule(nextProps.user, nextProps.week));
}
}
- loadingFinished(user) {
+ loadingFinished(user, week) {
return this.props.schedules.hasOwnProperty(user) &&
- this.props.schedules[user].state === 'finished';
+ this.props.schedules[user].hasOwnProperty(week) &&
+ this.props.schedules[user][week].state === 'finished';
}
render() {
- if (!this.loadingFinished(this.props.user)) {
+ if (!this.loadingFinished(this.props.user, this.props.week)) {
return (
<div>
Loading...
@@ -41,7 +43,7 @@ class View extends React.Component {
);
}
- const cleanHTML = cleanMeetingpointHTML(this.props.schedules[this.props.user].htmlStr);
+ const cleanHTML = cleanMeetingpointHTML(this.props.schedules[this.props.user][this.props.week].htmlStr);
return (
// eslint-disable-next-line react/no-danger
diff --git a/src/client/react/components/page/User.js b/src/client/react/components/page/User.js
index 980070f..72e92c2 100644
--- a/src/client/react/components/page/User.js
+++ b/src/client/react/components/page/User.js
@@ -26,7 +26,8 @@ const App = ({ match, location }) => {
<WeekSelector urlWeek={week} />
</div>
</div>
- <View user={user} />
+ {/* The View object just wants the week number. */}
+ <View user={user} week={week.week()} />
</div>
);
};