Skip to content

Conversation

@TylorS
Copy link
Member

@TylorS TylorS commented Mar 14, 2016

Instead of composing a historyDriver it internally chooses to use @cycle/history
accepting the same arguments expected by @cycle/history makeHistoryDriver to be passed
to makeRouterDriver(), but composes that driver instance to make a more useful routing
API.

Adjust define() to return an observable containing the latest values matched rather
than flatMapLatest()ing to sepearate all the values when they are inherently connected
rather than separate. This avoids the annoying path$.zip(value$, ...) boilerplate.

Remove the supportsHistory() and createLocation() utilities in favor of the those
provided by @cycle/history, and also exports createServerHistory for convenience.

Breaking Change:

BEFORE:

    const history = createHistory()
    const historyDriver = makeHistoryDriver(history)
    const routerDriver = makeRouterDriver(historyDriver)

    const {path$, value$} = router.define(routes)
    const page$ = path$.zip(value$, (path, value) => {...})

After:

    const routerDriver = makeRouterDriver(createHistory())
    const page$ = router.define(routes).map(({path, value}) => {...})

TylorS added 2 commits March 14, 2016 18:42
Instead of composing a historyDriver it internally chooses to use @cycle/history
accepting the same arguments expected by @cycle/history makeHistoryDriver to be passed
to makeRouterDriver(), but composes that driver instance to make a more useful routing
API.
Adjust define() to return an observable containing the latest values matched rather
than flatMapLatest()ing to sepearate all the values when they are inherently connected
rather than separate. The avoids the annoying path$.zip(value$, ...) boilerplate.
Remove the supportsHistory() and createLocation() utilities in favor of the those
provided by @cycle/history, and also exports createServerHistory for convenience.

Breaking Change:

  BEFORE:
    const history = createHistory()
    const historyDriver = makeHistoryDriver(history)
    const routerDriver = makeRouterDriver(historyDriver)

    const {path$, value$} = router.define(routes)
    const page$ = path$.zip(value$, (path, value) => {...})

  After:
    const routerDriver = makeRouterDriver(createHistory())
    const page$ = router.define(routes).map(({path, value}) => {...})
Removes createRouter because it's not very useful
TylorS added a commit that referenced this pull request Mar 14, 2016
@TylorS TylorS merged commit 471a9ba into master Mar 14, 2016
@TylorS TylorS deleted the api-changes branch June 1, 2016 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants