-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Repro for reframe issue: Improve exception handing associated with subs
- Loading branch information
1 parent
0a7ab27
commit 5034ad8
Showing
2 changed files
with
23 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
{:deps {org.clojure/clojurescript {:mvn/version "1.10.758"}}} | ||
{:deps {org.clojure/clojurescript {:mvn/version "1.10.758"} | ||
re-frame {:mvn/version "0.12.0"}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,22 @@ | ||
(ns hello-world.core) | ||
(ns hello-world.core | ||
(:require [reagent.core :as r] | ||
[reagent.dom :as rdom] | ||
[re-frame.core :as rf])) | ||
|
||
(println "Hello world!") | ||
(rf/reg-sub | ||
::throwing-sub | ||
(fn [_ _] | ||
(assert (odd? 2)) | ||
"fn sub")) | ||
|
||
(defn app [] | ||
[:p @(rf/subscribe [::throwing-sub])]) | ||
|
||
(defn error-boundary [] | ||
(let [*error (r/atom nil)] | ||
(r/create-class | ||
{:get-derived-state-from-error (fn [e] (reset! *error e)) | ||
:component-did-catch (fn [_ _ _] true) | ||
:reagent-render (fn [form] (if @*error [:div (str @*error)] form))}))) | ||
|
||
(rdom/render [error-boundary [app]] (js/document.getElementById "app")) |