Coder Social home page Coder Social logo

fusion-plugin-connected-react-router's Introduction

Modern framework for fast, powerful React apps

Build status fusion-core Downloads

What is it?

fu·sionnoun

The process or result of joining two or more things together to form a single entity.

Fusion.js, Uber’s open source universal web framework, represents the fusion of the client and the server. It's geared for server-side rendering out of the box, and its plugin-driven architecture allows for complex frontend and backend logic to be encapsulated in a single plugin:

import App from 'fusion-react';
import Router from 'fusion-plugin-react-router';

export default () => {
  const app = new App(<div>...</div>);

  /*
  One line of code sets up everything you need for routing:
  - Server rendering
  - React Providers on both server and browser
  - Bundle splitting integration
  - Hot module reloading support
  */
  app.register(Router);

  return app;
}

We initially built Fusion.js to make our own websites easier to maintain, but were so impressed with the benefits that we decided to offer it to the community as an open source project!

Try it out

If you're interested in giving Fusion.js a shot, Overview and Core Concepts are great places to start.

Contributing

This is a monorepo of all open source Fusion.js packages maintained using Yarn v2. Take a look at CONTRIBUTING.md for info on how to develop in this repo.

License

MIT

fusion-plugin-connected-react-router's People

Contributors

albertywu avatar alexmsmithca avatar dennisgl avatar ganemone avatar kevingrandon avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

fusion-plugin-connected-react-router's Issues

@@router/LOCATION_CHANGE events fired off multiple times on page load

Event @@router/LOCATION_CHANGE gets fired off 4x on page load. Looked around online and it seems like there's nothing mentioning this issue.

Type of issue

Bug?

Description

@@router/LOCATION_CHANGE action should get fired once on page load.

Current behavior

@@router/LOCATION_CHANGE action gets fired 4x on page load.
image

They all have the same exact payload.

{
  type: '@@router/LOCATION_CHANGE',
  payload: {
    location: {
      pathname: '/',
      search: '',
      hash: ''
    },
    action: 'POP',
    isFirstRendering: false
  }
}

Expected behavior

There should only be one @@router/LOCATION_CHANGE

Steps to reproduce

  1. Follow the README to install this plugin on your Fusion app
  2. Load a page.

Your environment

  • fusion-plugin-connected-react-router version: 1.1.1

  • Node.js version (node --version): 8.11.3

  • npm version (npm --version): 5.6.0

  • Operating System: macOS Mojave 10.14.3

Cannot read property 'pathname' of undefined

Type of issue

Bug

Description

Project builds successfully but I get following error on app start:

TypeError: Cannot read property 'pathname' of undefined
at /Users/muhammadali/WebstormProjects/fusion-visualizations/node_modules/connected-react-router/lib/ConnectedRouter.js:58:37
at dispatch (/Users/muhammadali/WebstormProjects/fusion-visualizations/node_modules/redux/lib/redux.js:220:7)
at /Users/muhammadali/WebstormProjects/fusion-visualizations/node_modules/redux-logger/dist/redux-logger.js:1:7807
at /Users/muhammadali/WebstormProjects/fusion-visualizations/node_modules/redux-thunk/lib/index.js:14:16
at oldDispatch (/Users/muhammadali/WebstormProjects/fusion-visualizations/node_modules/fusion-plugin-connected-react-router/src/index.js:37:20)
at /Users/muhammadali/WebstormProjects/fusion-visualizations/node_modules/connected-react-router/lib/middleware.js:25:18
at store.dispatch.action (/Users/muhammadali/WebstormProjects/fusion-visualizations/node_modules/fusion-plugin-connected-react-router/src/index.js:36:18)
at Object.onLocationChanged (/Users/muhammadali/WebstormProjects/fusion-visualizations/node_modules/connected-react-router/lib/ConnectedRouter.js:154:16)
at handleLocationChange (/Users/muhammadali/WebstormProjects/fusion-visualizations/node_modules/connected-react-router/lib/ConnectedRouter.js:85:17)
at new ConnectedRouter (/Users/muhammadali/WebstormProjects/fusion-visualizations/node_modules/connected-react-router/lib/ConnectedRouter.js:94:7)

My Code looks something like this:
app.register(RouterToken, Router)
app.register(RouterProviderToken, ConnectedRouter)
app.register(ConnectedRouterEnhancerToken, ConnectedRouterEnhancer)
app.register( EnhancerToken, createPlugin({ deps: { connectedRouterEnhancer: ConnectedRouterEnhancerToken }, provides: ({ connectedRouterEnhancer }) => { const enhancer = composeEnhancers( connectedRouterEnhancer, applyMiddleware(...middlewares), ) return enhancer }, }), )
app.register(ReduxToken, Redux)
app.register(ReducerToken, rootReducer)

Current behavior

App crashes

Steps to reproduce

I've followed the steps given in the documentation but failed to connect this plugin.

Your environment

  • fusion-plugin-connected-react-router version: 1.0.1

  • Node.js version: 8.11

  • npm version: 5.6.0

  • Operating System: macOS Mojave

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.