fusionjs / fusion-plugin-react-router Goto Github PK
View Code? Open in Web Editor NEWMigrated to https://github.com/fusionjs/fusionjs
License: MIT License
Migrated to https://github.com/fusionjs/fusionjs
License: MIT License
The exported Link component doesn't have type annotations, so when imported, it is any
.
Bug
On the browser the Redirect
component will cause an exception
Exception is thrown
Should work on browser and server
router
is marked as required in Redirect
, but its value is undefined
.'Bug
When fusion-core was updated to strip the routePrefix from ctx
, the router plugin was never updated to handle this behavior.
Links and route matching don't work as expected.
Links and route matching should work with the routePrefix.
<Route>
components and <Link>
componentsServer side redirects are setting the status
code correctly, but are not adding the Location
header. We should use ctx.redirect
Bug
MemoryRouter
does not provide onRoute
into child context
Besides it would be nice to be able to override onRoute
with some mock function
When using MemoryRouter
for UnitTesting it fails with following error:
TypeError: context.onRoute is not a function
Should not fails on this step
run following test snippet:
const component = mount(
<MemoryRouter initialEntries={['/test']}>
<Route path="/test" render={() => <div>Test</div>} />
</MemoryRouter>
);
expect(component.find('div').text()).toBe('Test');
fusion-plugin-react-router version: 1.2.0
Node.js version (node --version
): 8.14
npm version (npm --version
): 6.4.1
Operating System: OSX
The upstream and downstream timing events should probably be handled
by some standard stats library, not the router. It does make sense for
the router to emit render/pageview stats, but not more generic stats like
upstream and downstream.
Teams would like to be able to access the history
object that we use in this plugin for various use cases. One of them being syncing state to redux in https://github.com/ReactTraining/react-router/tree/master/packages/react-router-redux
Add a RouterToken
which we can use as a dependency to get access to history.
createPlugin({
RouterToken: router
}, ({router}) => {
// Will I be able to do this?
router.from(ctx).history
Feature request
The render
prop is the suggested approach for passing props to a Route
from a parent component but fusion-plugin-react-router
does not allow this property.
When passing the prop render
to the Route
component an error is thrown 'Cannot pass render function to tracking route'
.
Should be able to pass render
to a Route
The ROUTER_DATA element should be optional, so we can support non-ssr browser loads.
Bug
When rendering the Status component on the server if multiple children are passed in only the first is rendered.
Only first child is rendered
All children should render
It should be fully compatible with v4: https://reacttraining.com/blog/react-router-v5/
Documentation regarding Fusion API is out of date given recent changes to leverage new Dependency Injection architecture.
Update documentation
Feature request
Instead of using the globally scoped event emitter using an emitter scoped to the request should allow us to log events with context specific details (actual path and headers from the request). This would also require the context object being passed into the emit
call.
pageview:server
is emitted on the global event bus and does not include context.
pageview:server
is emitted on a event bus scoped to an individual request and includes the context.
I'm having trouble styling Link components. If you nest an anchor element or anchor component, Fusion will create another anchor instead of rendering one anchor. If you pass the Link component into styletron's withStyle, Fusion crashes.
Is there a way to style Links with styletron? I'd prefer to avoid using inline style and nesting a random element for the purposes of styling.
Feature request
There seems to be no way to set up redirects (302s) to external urls. I understand this might be to keep consistent behavior with react-router v4's browser redirect behavior. Perhaps we can offer an <ExternalRedirect>
component in fusion-plugin-react-router
to workaround this?
Alternatively, if there's some way of doing this otherwise, please document it.
Right now, in order to set up an external redirect route, I'm doing this. This method is clearly sub-optimal since the browser is loading the page with a null component just to redirect (and there's no way to leverage 302 status code here):
<Route
path={`/go-to-google`}
render={() => {
if (__BROWSER__) {
window.location.href = 'https://www.google.com';
}
return null;
}}
/>
Support a syntax like:
<Route
path={`/go-to-google`}
render={() => <Redirect to={"https://www.google.com"} />}
/>
In theory users could emit events with primitive values
for the event payload. We should only try and extend the
payload if it is a truthy object.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.