GithubHelp home page GithubHelp logo

ertugrulcetin / re-frame-flow Goto Github PK

View Code? Open in Web Editor NEW
145.0 4.0 4.0 1.05 MB

Graph based visualization tool for re-frame event chains

License: MIT License

Clojure 94.08% JavaScript 3.99% HTML 1.93%
re-frame clojurescript debugging tracing reagent event-flow clojure

re-frame-flow's Introduction

Re-frame Flow

re-frame-flow is a graph based visualization tool for re-frame event chains. Let's assume we clicked a login button and triggered a series of events. login-fx -> http-fx -> some-fx -> some-db-handler ... (event after event), so a path gets generated, re-frame-flow visualizes all paths in a graph.

Re-frame Flow

Installation

Clojars Project

  • Add re-frame-flow to dev dependencies:
:profiles
   {:dev
      {:dependencies [[org.clojars.ertucetin/re-frame-flow "X.Y.Z"]] }}
  • Add re-frame-flow.preload to preloads:
{...
 :preloads [re-frame-flow.preload]
 ...}

Usage

  • Make sure you have followed all of the installation instructions above.
  • Start up your application.
  • Once it is loaded, trigger some events (Flow panel gets updated when an event is triggered).
  • Focus the document window and press ctrl-g to open the flow panel.

Dispatch tracking (Optional)

If you want to track the flow of dispatch and dispatch-sync, you need to use re-frame-flow's custom dispatch and dispatch-sync. ClojureScript does not provide *ns* at runtime, so these functions implemented as custom macros. Which means you can't pass around like they are functions.

  • You need to move re-frame-flow dependency from dev to prod
  • Update your dev closure-defines inside shadow-cljs.edn
    •   :dev
         {:compiler-options
          {:closure-defines
           {re-frame-flow.trace.dispatch-enabled? true}}}
  • Update your views (or any namespace that uses dispatch)
    • (ns app.views
       (:require [re-frame-flow.macros :refer-macros [dispatch dispatch-sync]]
        ...))

Live Demo

Running the example

re-frame-flow's People

Contributors

ertugrulcetin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

re-frame-flow's Issues

Re-Frame accepts nil in :dispatch-n vector but re-frame-flow fails to handle it and throws errors.

I can pass nil into :dispatch-n fx vector successfully with re-frame but re-frame-flow fails to deal with this

https://github.com/day8/re-frame/blob/ecb756e66fe30efca896879369a420df1e271605/src/re_frame/fx.cljc#L147

(reg-fx
  :dispatch-n
  (fn [value]
    (if-not (sequential? value)
      (console :error "re-frame: ignoring bad :dispatch-n value. Expected a collection, but got:" value)
      (doseq [event (remove nil? value)] (router/dispatch event)))))

I get errors because of a nil id param being passed into these two re-frame-flow.core functions:

(defn- kw->str [id]
  (if (qualified-keyword? id)
    (str (namespace id) "/" (name id))
    (name id)))


(defn- id->node [id]
  {:id (kw->str id)
   :style {:fontSize 14
           :fontFamily "monospace"
           :wordBreak "break-word"
           :width 200}
   :data {:label id
          :name (name id)
          :namespace (namespace id)}
   :sourcePosition "right"
   :targetPosition "left"
   :position {:x 0 :y 0}})

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.