Comments (4)
It's actually a bug in the connect mixin that was trying to remove the event listener from itself instead of from the store. I'll publish an update soon to resolve it.
For the routing itself, I wouldn't generally recommend this option. Although it's convenient, it only really saves adding a switch mapping from the view name to the view html in the router outlet but it does have some implications around optimizations. Because the state store now depends on the html view templating it won't be quite as small as it otherwise could be. I prefer to try to keep it tiny so that it can initiate the routing, auth and any data requests as soon as possible while the UI may still be loading (those pieces tend to be significantly bigger).
Really depends on your approach to code-splitting though - I can see there are fewer moving parts having the views defined alongside the routes.
from rdx.
Updated - thanks for catching this!
from rdx.
You haven't show how you are rendering the views (the router outlet). What is and isn't connected to the DOM should depend on that.
from rdx.
import { customElement, property } from "lit-element";
import { Connected, Route, RouteSelectors, State } from "./connected";
declare global {
interface HTMLElementTagNameMap {
"app-view": AppViewElement;
}
}
@customElement("app-view")
export class AppViewElement extends Connected {
@property({ type: Object })
route: Route;
mapState(state: State) {
return {
route: RouteSelectors.route(state),
};
}
render() {
return this.route.view;
}
}
from rdx.
Related Issues (11)
- Docs home page poor contrast when OS uses dark mode
- Cannot run tests with mocha
- Rename ModelStore method `dispatch` to `getDispatch` HOT 1
- Need docs: IntelliSense (code completion) may break on arrow functions
- connect API for Svelte
- Array destructuring not recognised as reducer param HOT 5
- How to programmatically navigate to another page? HOT 1
- Integrate rdx-model with rdx HOT 2
- Plugins dispatch is never inferred
- Dark and light mode with switch HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rdx.