untangled

NEW CHANNEL: #fulcro
2016-08-16T18:34:32.000518Z

is GC run after every merge?

tony.kay 2016-08-16T18:34:42.000519Z

no such thing

2016-08-16T18:35:04.000520Z

i thought there was something that crawls links and deletes data that has no links to it

2016-08-16T18:35:11.000521Z

how do I cleanup normalized data?

tony.kay 2016-08-16T18:35:38.000522Z

Nope, there is no way to not make that buggy.

2016-08-16T18:36:06.000523Z

if I merge data {:id 3 :foo {:id 4}} and it's normalized to {:x {3 ..} :y {4 ..} } and then I merge data {:id 3 :foo nil}

tony.kay 2016-08-16T18:36:11.000524Z

e.g. I have a list of users. I run a filter to show those that start with 'A'. Now my database only has links to a subset...do I clean those just because a "GC" runs?

2016-08-16T18:36:18.000525Z

how do I cleanup :y automatically

tony.kay 2016-08-16T18:36:32.000526Z

Untangled is not involved. It is your database.

2016-08-16T18:37:00.000527Z

ok, this makes me want to not normalize data šŸ˜ž

2016-08-16T18:37:05.000528Z

so I don't have to deal with this pain

2016-08-16T18:37:17.000529Z

this is a trait of OM in general I understand

tony.kay 2016-08-16T18:37:25.000530Z

There is no free lunch in programming. What is a trait?

tony.kay 2016-08-16T18:37:59.000531Z

if you don't normalize data, then you have other more serious problems.

2016-08-16T18:39:00.000532Z

well there's some logic you have to write that is essentially checking if table is not referenced by any links, and seems like i have to write this over and over again for each situation that arises

2016-08-16T18:39:10.000533Z

like a search engine that loads search results

2016-08-16T18:39:14.000534Z

each search query loads new search results

2016-08-16T18:39:17.000535Z

so you have to cleanup after yourself

2016-08-16T18:39:24.000536Z

which search results are no longer referenced

tony.kay 2016-08-16T18:39:33.000537Z

So just clean the entire table as part of the query logic

2016-08-16T18:39:57.000539Z

in my example, each time the search query changes, I empty the search results table?

tony.kay 2016-08-16T18:39:59.000540Z

that is much simpler and more reliable than an automatic GC that you have to program

tony.kay 2016-08-16T18:40:53.000542Z

I mean, I guess you could write some kind of GC of your own...it is a simple algorithm if you make certain assumptions (e.g. no refs means cleanup, which isn't good enough for all apps, but might be ok for yours).

tony.kay 2016-08-16T18:41:34.000543Z

but unless you're worried about killing a javascript VM with data size, I would not even worry about it.

tony.kay 2016-08-16T18:41:56.000544Z

most apps don't have huge data sets, and js can have a pretty darn large memory footprint.

tony.kay 2016-08-16T18:42:24.000545Z

anyway...if you write GC, just transact on the reconciler once every 15 minutes or something.

2016-08-16T18:42:41.000546Z

"So just clean the entire table as part of the query logic" in my example this means in the search mutation, I empty the search-results table first before doing load-action ?

tony.kay 2016-08-16T18:42:48.000547Z

yep

2016-08-16T18:42:57.000548Z

i don't have time to write GC, for some reason I thought you wrote one šŸ˜„

2016-08-16T18:43:11.000549Z

i'll make do with the other methods

tony.kay 2016-08-16T18:43:35.000550Z

we have been writing pretty large apps, and have not found a need for general GC yet, nor is there a great way to solve it in general, as I said.

tony.kay 2016-08-16T18:43:54.000551Z

You could do things like mark tables with metadata (no-gc), etc.

tony.kay 2016-08-16T18:44:08.000552Z

but I don't tend to do work unless I need it šŸ™‚

2016-08-16T18:45:08.000553Z

what about stale data interfering with newly merged data

2016-08-16T18:45:28.000554Z

anything to worry about there?

tony.kay 2016-08-16T18:45:47.000555Z

If you queried for it, it will overwrite it. How can it be stale?

tony.kay 2016-08-16T18:46:11.000556Z

Untangled does include logic to stomp on stuff that has disappeared (was queried for, but didn't appear)

tony.kay 2016-08-16T18:46:20.000557Z

but that is at an attribute level, not entity

tony.kay 2016-08-16T18:46:46.000558Z

(so a ref might disappear, but not the row in the table)

tony.kay 2016-08-16T18:47:59.000559Z

As I said: no way to be sure (from a library) that a given row in your database is gone, unless the application can prove it. Just because you don't have a UI ref to a user object doesn't mean it is "gone" in your application (might still be persisted on server).

tony.kay 2016-08-16T18:48:24.000560Z

Add in websockets and entity subscriptions with datomic: now we're talking

2016-08-16T18:48:32.000561Z

nods

tony.kay 2016-08-16T18:48:41.000562Z

but then you'd have to manage subscriptions šŸ™‚

tony.kay 2016-08-16T18:48:53.000563Z

so it really just pushes the problem off by one step

tony.kay 2016-08-16T18:49:20.000564Z

leaking subscriptions instead of rows

2016-08-16T18:49:32.000565Z

i didn't normalize my search results and so far it's been fine

tony.kay 2016-08-16T18:49:39.000566Z

that's ok too

2016-08-16T18:49:50.000567Z

i'm using normalization on a case by case basis

2016-08-16T18:49:56.000568Z

"will it help me solve this problem"

tony.kay 2016-08-16T18:49:57.000569Z

if you don't need data in more than one place, it is perfectly acceptable to treat it as a blob

2016-08-16T18:50:07.000570Z

nodS

tony.kay 2016-08-16T18:50:34.000571Z

well, mutating it gets more complex and less modular...but if it is read-only search result data, who cares

grzm 2016-08-16T19:43:42.000573Z

I've got a UI that's not updating after a post-mutate after a data-fetch. Looking at the app-state, the data is there where I expect it to be. When I save a file and the react-key is updated, the data shows up in the right place. Any suggestions where I might look?

grzm 2016-08-16T19:44:21.000574Z

Something's not triggering a refresh, right?

2016-08-16T20:28:08.000575Z

@grzm try overriding shouldComponentUpdate to return true ā€” see if that causes the re-render

2016-08-16T20:28:37.000576Z

if it does, then the issue is with omā€™s implementation of shouldComponentUpdate. weā€™ve seen the behavior before, isolated one case of it, but itā€™s possible we havenā€™t found all of them

grzm 2016-08-16T20:30:07.000577Z

@ethangracer: Thanks for the idea. I suspect it's more something in my particular application, and that this is just a symptom of something I've done wrong.

2016-08-16T20:33:27.000578Z

@grzm fair enough, Iā€™ve run into that issue plenty of times. youā€™ve already verified that the data is showing up in your app state, meaning the network request completed. if the request completed and the data was put in your app-state, then the data fetch called merge! with your data on the reconciler. Which schedules a re-render through om. So if the re-render isnā€™t happening, itā€™s either because you havenā€™t included a necessary key in the :refresh parameter to load-data, or because somethingā€™s confusing omā€™s shouldComponentUpdate

grzm 2016-08-16T20:34:18.000579Z

Thanks. I'll definitely look into :refresh. I suspect that's it.

šŸ‘ 1