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

fixup ts types and tweak createRouter #213

Merged
merged 3 commits into from
Dec 29, 2018
Merged

fixup ts types and tweak createRouter #213

merged 3 commits into from
Dec 29, 2018

Conversation

jquense
Copy link
Member

@jquense jquense commented Nov 21, 2018

No description provided.

package.json Outdated
"prop-types-extra": "^1.0.1",
"react-redux": "^5.0.7",
"react-redux": "^5.1.1",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixes a bug with contextType

render,
renderPending,
renderReady,
renderError,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

practically i've never seen us save bytes here before. you almost always end up using createRender

@@ -0,0 +1,94 @@
// TypeScript Version: 3.0

import * as React from 'react';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stole this pattern from emotion

package.json Outdated
"lib",
"index.d.ts"
],
"files": ["lib", "types/index.d.ts"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you run prettier on this? :p

renderError,
}) {
// eslint-disable-next-line no-param-reassign
render =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, this would require updating the README at least

i'm not 100% sure about this. i put createRender at the top level because of bundle size concerns, but perhaps those are irrelevant

i think we would be better off exposing better higher-level abstractions, maybe – something like a createRelayRouter in found relay and a createHashRouter here, perhaps

how do you find yourself using createFarceRouter other than for the relay things with a custom resolver?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in practice we've never used a lower level router without createRender, to do so you'd need to manage/implement ElementsRenderer yourself as well as StaticContainer. I don't think there are any people who need that level of bundle min/maxing esp if we never do it as the main consumers

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense. update the docs then?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the FarceRouter case could be handled via additional router factories but we're using createConnectedRouter to pass in an external redux store in a few places and that sort of auto drops you into the lowest level api.

There should also be a unified store enhancer i think

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh gosh QOL :p

routeConfig,
matcherOptions,
}) {
return compose(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did i do this right?

);

store.dispatch(FarceActions.init());
store.startRouting();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seemed like an easy way to save an import?

README.md Outdated Show resolved Hide resolved
README.md Outdated
new Matcher(routeConfig, { matchStemRoutes: false }),
),
),
createFoundEnhancer({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, i wasn't totally a fan of this out of a sense of paranoia... my concern was something like – what if the user ended up with two versions of farce in the tree or something? double-importing action types is whatever, but the actual code... ?

README.md Outdated Show resolved Hide resolved
src/createFoundEnhancer.js Outdated Show resolved Hide resolved
@taion
Copy link
Contributor

taion commented Dec 27, 2018

err you may want to rebase this. sorry

@taion
Copy link
Contributor

taion commented Dec 29, 2018

Huh, any idea why CI is failing?

@taion
Copy link
Contributor

taion commented Dec 29, 2018

ok, needed to upgrade dtslint

@taion taion merged commit a12d9e4 into master Dec 29, 2018
@taion taion deleted the qol branch December 29, 2018 03:11
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.

None yet

2 participants