flexsurfer / re-frisk

Take full control of re-frame app
https://flexsurfer.github.io/conduit-re-frisk-demo/
456 stars 29 forks source link

Console error expanding app-db when it contains a datascript connection #12

Closed timgilbert closed 6 years ago

timgilbert commented 7 years ago

Hi. I'm storing a datascript connection object in my app-db in a re-frame project, and when I try to expand the app-db key in re-frisk, I get the following console errors (see below).

A datascript connection is arguably not the sort of thing one should properly store in the app-db, since it's more of a stateful component than pure data. Nonetheless, it would be nice if re-frisk didn't throw an error when trying to display it. I could imagine two potential workarounds. The best behavior might be for the re-frisk bits that render a string for each key in the app-db to catch exceptions, log them to the browser, and emit like "##ERROR##" as the value in the shell.

The quicker workaround would maybe be for the library user to pass in a list of keys to skip over in the app-db via the :re-frisk config key or the config map passed to (enable-re-frisk!).

My project is in a bit of a messy state right now, but let me know if providing sample code to reproduce would be helpful. Thanks!

component.cljs?rel=1480015918251:123 Error rendering component (in re_frisk.ui.re_frisk_shell 
> re_frisk.core.frisk_inline > datafrisk.core.FriskInline > datafrisk.core.Root 
> datafrisk.core.DataFrisk > datafrisk.core.MapNode > datafrisk.core.KeyValNode 
> datafrisk.core.DataFrisk > datafrisk.core.DataFrisk > datafrisk.core.MapNode 
> datafrisk.core.KeyValNode > datafrisk.core.DataFrisk > datafrisk.core.DataFrisk 
> datafrisk.core.MapNode > datafrisk.core.KeySet)
core.cljs:8199
 Uncaught TypeError: me.cljs$core$IMapEntry$_key$arity$1 is not a function(…)cljs.core.KeySeq.cljs$core$ISeq$_first$arity$1 @ core.cljs:8199
cljs$core$first @ core.cljs:1133
(anonymous function) @ core.cljs:4190
cljs.core.map_indexed.cljs$core$IFn$_invoke$arity$2.mapi @ core.cljs:4190
cljs.core.LazySeq.sval @ core.cljs:3256
cljs.core.LazySeq.cljs$core$ISeqable$_seq$arity$1 @ core.cljs:3310
cljs$core$seq @ core.cljs:1112
cljs.core.interleave.cljs$core$IFn$_invoke$arity$2 @ core.cljs:4648
cljs.core.LazySeq.sval @ core.cljs:3256
cljs.core.LazySeq.cljs$core$ISeqable$_seq$arity$1 @ core.cljs:3310
cljs$core$seq @ core.cljs:1112
step @ core.cljs:4566
cljs.core.drop.cljs$core$IFn$_invoke$arity$2 @ core.cljs:4570
cljs.core.LazySeq.sval @ core.cljs:3256
cljs.core.LazySeq.cljs$core$ISeqable$_seq$arity$1 @ core.cljs:3310
cljs$core$seq @ core.cljs:1112
cljs.core.seq_reduce.cljs$core$IFn$_invoke$arity$3 @ core.cljs:2336
cljs.core.LazySeq.cljs$core$IReduce$_reduce$arity$3 @ core.cljs:3320
cljs.core.reduce.cljs$core$IFn$_invoke$arity$3 @ core.cljs:2382
cljs.core.into_array.cljs$core$IFn$_invoke$arity$2 @ core.cljs:430
cljs.core.into_array.cljs$core$IFn$_invoke$arity$1 @ core.cljs:428
cljs$core$into_array @ core.cljs:424
reagent$impl$template$expand_seq_dev @ template.cljs?rel=1480015918423:336
(anonymous function) @ template.cljs?rel=1480015918423:347
reagent$ratom$in_context @ ratom.cljs?rel=1480015918083:37
reagent$ratom$check_derefs @ ratom.cljs?rel=1480015918083:512
reagent$impl$template$expand_seq_check @ template.cljs?rel=1480015918423:347
reagent$impl$template$as_element @ template.cljs?rel=1480015918423:321
reagent$impl$template$make_element @ template.cljs?rel=1480015918423:388
reagent$impl$template$native_element @ template.cljs?rel=1480015918423:275
reagent$impl$template$vec_to_elem @ template.cljs?rel=1480015918423:298
reagent$impl$template$as_element @ template.cljs?rel=1480015918423:319
reagent$impl$component$wrap_render @ component.cljs?rel=1480015918251:101
reagent$impl$component$do_render @ component.cljs?rel=1480015918251:118
(anonymous function) @ component.cljs?rel=1480015918251:140
reagent$ratom$in_context @ ratom.cljs?rel=1480015918083:37
reagent$ratom$deref_capture @ ratom.cljs?rel=1480015918083:43
reagent$ratom$run_in_reaction @ ratom.cljs?rel=1480015918083:501
datafrisk.core.KeySet_render @ component.cljs?rel=1480015918251:140
_renderValidatedComponentWithoutOwnerOrContext @ react.inc.js:6466
_renderValidatedComponent @ react.inc.js:6492
performInitialMount @ react.inc.js:6034
mountComponent @ react.inc.js:5922
mountComponent @ react.inc.js:13488
mountChildren @ react.inc.js:12333
_createInitialChildren @ react.inc.js:7438
mountComponent @ react.inc.js:7263
mountComponent @ react.inc.js:13488
mountChildren @ react.inc.js:12333
_createInitialChildren @ react.inc.js:7438
mountComponent @ react.inc.js:7263
mountComponent @ react.inc.js:13488
performInitialMount @ react.inc.js:6048
mountComponent @ react.inc.js:5922
mountComponent @ react.inc.js:13488
performInitialMount @ react.inc.js:6048
mountComponent @ react.inc.js:5922
mountComponent @ react.inc.js:13488
performInitialMount @ react.inc.js:6048
mountComponent @ react.inc.js:5922
mountComponent @ react.inc.js:13488
mountChildren @ react.inc.js:12333
_createInitialChildren @ react.inc.js:7438
mountComponent @ react.inc.js:7263
mountComponent @ react.inc.js:13488
mountChildren @ react.inc.js:12333
_createInitialChildren @ react.inc.js:7438
mountComponent @ react.inc.js:7263
mountComponent @ react.inc.js:13488
performInitialMount @ react.inc.js:6048
mountComponent @ react.inc.js:5922
mountComponent @ react.inc.js:13488
_mountChildAtIndex @ react.inc.js:12518
_updateChildren @ react.inc.js:12434
updateChildren @ react.inc.js:12394
_updateDOMChildren @ react.inc.js:7672
updateComponent @ react.inc.js:7501
receiveComponent @ react.inc.js:7457
receiveComponent @ react.inc.js:13570
updateChildren @ react.inc.js:4290
_reconcilerUpdateChildren @ react.inc.js:12304
_updateChildren @ react.inc.js:12406
updateChildren @ react.inc.js:12394
_updateDOMChildren @ react.inc.js:7672
updateComponent @ react.inc.js:7501
receiveComponent @ react.inc.js:7457
receiveComponent @ react.inc.js:13570
_updateRenderedComponent @ react.inc.js:6418
_performComponentUpdate @ react.inc.js:6396
updateComponent @ react.inc.js:6315
receiveComponent @ react.inc.js:6215
receiveComponent @ react.inc.js:13570
_updateRenderedComponent @ react.inc.js:6418
_performComponentUpdate @ react.inc.js:6396
updateComponent @ react.inc.js:6315
receiveComponent @ react.inc.js:6215
receiveComponent @ react.inc.js:13570
_updateRenderedComponent @ react.inc.js:6418
_performComponentUpdate @ react.inc.js:6396
updateComponent @ react.inc.js:6315
receiveComponent @ react.inc.js:6215
receiveComponent @ react.inc.js:13570
updateChildren @ react.inc.js:4290
_reconcilerUpdateChildren @ react.inc.js:12304
_updateChildren @ react.inc.js:12406
updateChildren @ react.inc.js:12394
_updateDOMChildren @ react.inc.js:7672
updateComponent @ react.inc.js:7501
receiveComponent @ react.inc.js:7457
receiveComponent @ react.inc.js:13570
updateChildren @ react.inc.js:4290
_reconcilerUpdateChildren @ react.inc.js:12304
_updateChildren @ react.inc.js:12406
updateChildren @ react.inc.js:12394
_updateDOMChildren @ react.inc.js:7672
updateComponent @ react.inc.js:7501
receiveComponent @ react.inc.js:7457
receiveComponent @ react.inc.js:13570
_updateRenderedComponent @ react.inc.js:6418
_performComponentUpdate @ react.inc.js:6396
updateComponent @ react.inc.js:6315
receiveComponent @ react.inc.js:6215
receiveComponent @ react.inc.js:13570
updateChildren @ react.inc.js:4290
_reconcilerUpdateChildren @ react.inc.js:12304
_updateChildren @ react.inc.js:12406
updateChildren @ react.inc.js:12394
_updateDOMChildren @ react.inc.js:7672
updateComponent @ react.inc.js:7501
receiveComponent @ react.inc.js:7457
receiveComponent @ react.inc.js:13570
updateChildren @ react.inc.js:4290
_reconcilerUpdateChildren @ react.inc.js:12304
_updateChildren @ react.inc.js:12406
updateChildren @ react.inc.js:12394
_updateDOMChildren @ react.inc.js:7672
updateComponent @ react.inc.js:7501
receiveComponent @ react.inc.js:7457
receiveComponent @ react.inc.js:13570
_updateRenderedComponent @ react.inc.js:6418
_performComponentUpdate @ react.inc.js:6396
updateComponent @ react.inc.js:6315
receiveComponent @ react.inc.js:6215
receiveComponent @ react.inc.js:13570
_updateRenderedComponent @ react.inc.js:6418
_performComponentUpdate @ react.inc.js:6396
updateComponent @ react.inc.js:6315
receiveComponent @ react.inc.js:6215
receiveComponent @ react.inc.js:13570
updateChildren @ react.inc.js:4290
_reconcilerUpdateChildren @ react.inc.js:12304
_updateChildren @ react.inc.js:12406
updateChildren @ react.inc.js:12394
_updateDOMChildren @ react.inc.js:7672
updateComponent @ react.inc.js:7501
receiveComponent @ react.inc.js:7457
receiveComponent @ react.inc.js:13570
_updateRenderedComponent @ react.inc.js:6418
_performComponentUpdate @ react.inc.js:6396
updateComponent @ react.inc.js:6315
performUpdateIfNecessary @ react.inc.js:6229
performUpdateIfNecessary @ react.inc.js:13604
runBatchedUpdates @ react.inc.js:14438
perform @ react.inc.js:16668
perform @ react.inc.js:16668
perform @ react.inc.js:14377
flushBatchedUpdates @ react.inc.js:14460
closeAll @ react.inc.js:16734
perform @ react.inc.js:16681
batchedUpdates @ react.inc.js:10161
enqueueUpdate @ react.inc.js:14488
enqueueUpdate @ react.inc.js:14086
enqueueForceUpdate @ react.inc.js:14218
ReactComponent.forceUpdate @ react.inc.js:5334
reagent$impl$batching$run_queue @ batching.cljs?rel=1480015917617:39
reagent.impl.batching.RenderQueue.flush_queues @ batching.cljs?rel=1480015917617:86
reagent.impl.batching.RenderQueue.run_queues @ batching.cljs?rel=1480015917617:76
(anonymous function) @ batching.cljs?rel=1480015917617:63
flexsurfer commented 7 years ago

hi @timgilbert , thank you for the report, I'm using Odinodin/data-frisk-reagent library for render data, so i created the issue in his repo, maybe he can help