There were a couple issues with the original version of
`resolvePromiseProperties`:
- The wrapper promise was unnecessary, since we can just return the
`Promise.all`. Fixing this allows us to remove a wrapping function,
reduce indentation, remove the `resolve` and `reject` calls, and
remove the now unnecessary `.catch` line.
- There was inadvertent mutation in the `Object.assign` call - the
first parameter to `Object.assign` is mutated, so to call it without
mutating existing objects the first parameter should be a literal
`{}`. This is now fixed.
The log out menu was nested within a button, which caused
bubbling issues for the log out button event handler. This
was due to a misuse of the React Toolbox AppBar component.
Added a proper IconMenu to trigger the logout dropdown.
`resolvePromiseProperties` takes on object and returns a promise which
resolves to a copy of the object. This copy has all its immediate
properties which were Promises replaced with the resolved value of
those promises. Promises are run with `Promise.all`. Errors are passed
up to the outer promise chain.
Example usage:
```js
resolvePromiseProperties({
promise: Promise.resolve("this property will resolve to this string"),
nonPromise: "this will remain the same",
// you can nest the function
nestedPromiseInside: resolvePromiseProperties({
nestedPromise: Promise.resolve("this will resolve"),
nestedNonPromise: "this stays the same",
}),
})
.then(obj => console.log(obj))
```
That will produce the following output:
```js
{
promise: "this property will resolve to this string",
nonPromise: "this will remain the same",
nestedPromiseInside: {
nestedPromise: "this will resolve",
nestedNonPromise: "this stays the same",
},
}
```
- New state field: `state.entryDraft.hasChanged`, initialized to
`false`.
- `state.entryDraft.hasChanged` set to `true` in `entryDraft` reducer
for `DRAFT_CHANGE_FIELD`.
- `EntryPage` adds a `listenBefore` listener to `history` on
`componentDidMount` that checks `this.props.entryDraft.hasChanged`
and, if that is true, asks the user to confirm the navigation.
- `EntryPage` removes its listener on `componentWillUnmount`.