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

Revert fetchDataDeferred behaviour on Widgets page #872

Closed
wants to merge 30 commits into from

Conversation

sars
Copy link
Contributor

@sars sars commented Jan 26, 2016

No description provided.

Michal Svrček and others added 11 commits January 14, 2016 14:10
`import { Navbar, Nav, NavItem } from 'react-bootstrap';` includes all react-bootstrap modules. By including the modules explicitly (i.e. `import Navbar from 'react-bootstrap/lib/Navbar';`), we can decrease the size of the production js-file and speed up hot reloading drastically.
docs(guide):  Add 'Adding Text to Home Page' guide
hoist-non-react-statics no longer needed
@@ -28,7 +28,10 @@ export default class Widgets extends Component {
static reduxAsyncConnect(params, store) {
const {dispatch, getState} = store;
if (!isLoaded(getState())) {
return dispatch(loadWidgets());
const promise = dispatch(loadWidgets());
if (__SERVER__) {

Choose a reason for hiding this comment

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

this definitely solves the problem, but it's a patch. For example, we have them everywhere in our app and it'd be too routine and not pretty to have if (__SERVER__) { everywhere. This does show how to solve it though

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems for me, that logic of fetchDataDeferred was not really obvious...
Of course, I can add new static method , analogue of fetchDataDeferred, but i'd like to find more elegant solution...

Choose a reason for hiding this comment

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

hmm weird, i thought i replied to this. Sorry for the late reply. I do think a more elegant solution would be best, not sure how other than another static method that will be called after transition or componentDidMount. Or it could even be in a form of a helper? So a callback helper to be called, then youd save having two static methods.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought... may be for this purposes we can simply create new function that will wrap promise and return promise or undefined, depends where we are - on server or on client...

Choose a reason for hiding this comment

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

yeah, that could work

Choose a reason for hiding this comment

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

... depends where we are - on server or on client...

check window object may work in this case

const isServerSide = typeof window !== 'object';

reference PR at redux-async-connect #23

Copy link

Choose a reason for hiding this comment

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

@sars I really like redial's approach on defer:
https://github.com/markdalgleish/redial

@quicksnap
Copy link
Collaborator

Is this linked to an open issues?

@quicksnap
Copy link
Collaborator

Duh.. should have read: #833

@sars sars force-pushed the simple-router-data-deferred branch from da8f2c2 to e60b23c Compare February 11, 2016 12:29
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

10 participants