Coder Social home page Coder Social logo

Comments (4)

CaptainCodeman avatar CaptainCodeman commented on September 26, 2024 1

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.

CaptainCodeman avatar CaptainCodeman commented on September 26, 2024 1

Updated - thanks for catching this!

from rdx.

CaptainCodeman avatar CaptainCodeman commented on September 26, 2024

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.

anoblet avatar anoblet commented on September 26, 2024
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)

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.