Skip to content
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

Fix custom theme and settings #759

Merged
merged 5 commits into from
Jul 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
import OldThemeProvider from './Theme/ThemeProvider'
import { getActiveEndpoints } from './util'
import { ISettings } from '../types'
import { createStructuredSelector } from 'reselect'
import { connect } from 'react-redux'
import { getTheme, getSettings } from '../state/workspace/reducers'
import { Session, Tab } from '../state/sessions/reducers'
Expand Down Expand Up @@ -511,10 +510,11 @@ class PlaygroundWrapper extends React.Component<
}
}

const mapStateToProps = createStructuredSelector({
theme: getTheme,
settings: getSettings,
})
const mapStateToProps = (state, ownProps) => {
const theme = ownProps.theme || getTheme(state, ownProps.settings)
const settings = ownProps.settings || getSettings(state)
return { theme, settings }
}

export default connect(
mapStateToProps,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export function normalizeSettingsString(settingsString) {
return JSON.stringify(parseSettingsString(settingsString), null, 2)
}

export const getTheme = createSelector(
[getSettings],
s => s['editor.theme'] || 'dark',
)
export const getTheme = (state, customSettings) => {
const settings = customSettings || getSettings(state)
return settings['editor.theme'] || 'dark'
}