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

<div> wrapping needed when switching views #77

Open
bbarker opened this issue Oct 5, 2017 · 0 comments
Open

<div> wrapping needed when switching views #77

bbarker opened this issue Oct 5, 2017 · 0 comments

Comments

@bbarker
Copy link
Contributor

bbarker commented Oct 5, 2017

I implemented a simple router, along with some helper functions, here. In the working example, we have the helper class:

  implicit class RxNode(val rxNode: Rx[Node]) extends AnyVal {
    def toNode(errNode: Node = <div>Error/404</div>): Node = {
      val nodeOuter = <div>{ rxNode }</div>
      nodeOuter.child.headOption match {
        case Some(nd) => <div class="debug">{ nd }</div>
        case None => errNode
      }
    }
  }

I don't understand why the first case can't just be case Some(nd) => nd, but if you leave it as that, you will see bad things happen when you switch between the path #/counter and any other path starting with #/ (i.e., some html wills stay there and not be replaced, while new html continues to be added to the view).

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

No branches or pull requests

1 participant