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

Simple, robust and performant API #597

Closed
wants to merge 28 commits into from
Closed
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Next

add deprecation warnings to react-fela

  • Loading branch information...
rofrischmann committed Aug 15, 2018
commit 5d73bb192168762ad34a667fd9b97d76324dd8d1
File renamed without changes.
@@ -0,0 +1,18 @@
const cache = {}

export function deprecate(message) {
if (process.env.NODE_ENV !== 'production' && !cache[message]) {
console.warn(message)
cache[message] = true
}
}

export function interceptDeprecation(component, message) {
deprecate(message)
return component
}

export function pipeDeprecation(method, message) {
deprecate(message)
return (...args) => method(...args)
}
@@ -1,21 +1,50 @@
/* @flow */
import connect from './connect'
import createComponent from './createComponent'
import createComponentWithProxy from './createComponentWithProxy'
import deprecated_connect from './connect'
import deprecated_createComponent from './createComponent'
import deprecated_createComponentWithProxy from './createComponentWithProxy'
import FelaComponent from './FelaComponent'
import FelaTheme from './FelaTheme'
import Provider from './Provider'
import RendererProvider from './RendererProvider'
import ThemeProvider from './ThemeProvider'
import withTheme from './withTheme'
import fe from './fe'

import { pipeDeprecation, interceptDeprecation } from './deprecate'

const connect = pipeDeprecation(
deprecated_connect,
`react-fela's connect() HoC is deprecated.
In order to provide a minimal, robust and performant API, we are moving everything over to render-props APIs.
Use the <FelaComponent> instead. See http://fela.js.org/docs/api/bindings/FelaComponent.html`
)

const createComponent = pipeDeprecation(
deprecated_createComponent,
`react-fela's createComponent() HoC is deprecated.
In order to provide a minimal, robust and performant API, we are moving everything over to render-props APIs.
Use the <FelaComponent> instead. See http://fela.js.org/docs/api/bindings/FelaComponent.html`
)

const createComponentWithProxy = pipeDeprecation(
deprecated_createComponentWithProxy,
`react-fela's createComponentWithProxy() HoC is deprecated.
In order to provide a minimal, robust and performant API, we are moving everything over to render-props APIs.
Use the <FelaComponent> instead. See http://fela.js.org/docs/api/bindings/FelaComponent.html`
)

const Provider = interceptDeprecation(
RendererProvider,
`Importing 'Provider' from react-fela is deprecated. Import 'RendererProvider' instead.`
)

export {
connect,
createComponent,
createComponentWithProxy,
FelaComponent,
FelaTheme,
Provider,
RendererProvider,
ThemeProvider,
withTheme,
fe,
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.