Fixed: Goodreads bookshelves not shown after authentication

pull/770/head
ta264 4 years ago committed by Qstick
parent 93ba5ade9e
commit 64e2f6457d

@ -182,7 +182,8 @@ BookshelfInput.propTypes = {
BookshelfInput.defaultProps = { BookshelfInput.defaultProps = {
className: styles.bookshelfInputWrapper, className: styles.bookshelfInputWrapper,
inputClassName: styles.input inputClassName: styles.input,
isPopulated: false
}; };
export default BookshelfInput; export default BookshelfInput;

@ -3,22 +3,22 @@ import PropTypes from 'prop-types';
import React, { Component } from 'react'; import React, { Component } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { createSelector } from 'reselect'; import { createSelector } from 'reselect';
import { clearOptions, fetchOptions } from 'Store/Actions/providerOptionActions'; import { clearOptions, defaultState, fetchOptions } from 'Store/Actions/providerOptionActions';
import BookshelfInput from './BookshelfInput'; import BookshelfInput from './BookshelfInput';
function createMapStateToProps() { function createMapStateToProps() {
return createSelector( return createSelector(
(state) => state.providerOptions, (state) => state.providerOptions.bookshelves || defaultState,
(state, props) => props.name, (state, props) => props.name,
(state, name) => { (bookshelves, name) => {
const { const {
items, items,
...otherState ...otherState
} = state; } = bookshelves;
return ({ return ({
helptext: items.helptext && items.helptext[name] ? items.helptext[name] : '', helptext: items.helptext && items.helptext[name] ? items.helptext[name] : '',
user: items.user ? items.user : '', user: items && items.user ? items.user : '',
items: items.shelves ? items.shelves : [], items: items && items.shelves ? items.shelves : [],
...otherState ...otherState
}); });
} }
@ -50,7 +50,7 @@ class BookshelfInputConnector extends Component {
} }
componentWillUnmount = () => { componentWillUnmount = () => {
this.props.dispatchClearOptions(); this.props.dispatchClearOptions({ section: 'bookshelves' });
} }
// //
@ -65,6 +65,7 @@ class BookshelfInputConnector extends Component {
} = this.props; } = this.props;
dispatchFetchOptions({ dispatchFetchOptions({
section: 'bookshelves',
action: 'getBookshelves', action: 'getBookshelves',
queryParams: { name }, queryParams: { name },
provider, provider,

Loading…
Cancel
Save