Fork me on GitHub
#cljsrn
<
2016-10-10
>
Niclas08:10:54

Using AsyncStorage, is there a way to deploy one’s app with a pre-built DB?

Niclas08:10:02

Some background: I have a hash-map datastructure of 15k static entries that I’d like to bundle with my app. Currently I store this in a JSON file that I require on app boot with (js->clj (js/require “path-to.json”)), which loads too slowly. My idea was to instead transform the JSON data to some reasonable datastructure that could be statically bundled and loaded on boot from AsyncStorage, removing the parsing time from the 5mb large JSON file

savelichalex09:10:58

@looveh you need to write native module

knotschi15:10:12

@pesterhazy I also tried to use :value first but because of these problems we did the same as @misha there (using :default-value - which is actually not a proper model-view binding anymore...). fortunately we never had to change the value of an already rendered input field.

pesterhazy16:10:47

@knotschi, somebody should write a blog post about this

misha16:10:32

@pesterhazy can you describe an update already mounted component use case in more details? from my pov, component enclosing text-input either has local state, or accepts text-input value as an argument. in both cases, if state gets changed - text-input gets updated.

pesterhazy16:10:00

yeah that's what I mean

misha16:10:28

and as long, as ui is responsive and does not stutter - I don't really care (and, honestly, don't really know kappa ) if it is done by means of re-usint text-input, or creating new one on every key stroke.

misha16:10:49

I noticed weird artifact on some inputs: when you clear it up with backspace (or whatever key is on visual kb) - it often leaves letter g or some other letter, as if it was a placeholder, but it is actually input text. and I can't delete it. but I did not spend any time to debug this yet.

misha16:10:40

reloading simulator helps, but not for long opieop

savelichalex16:10:11

@misha what do you mean by "create new one on every stroke"?

misha16:10:37

rn might unmount current text-input with old value, and mount another text-input with a new value

misha16:10:04

I didn't bother to figure out whether this is actually the case or not

savelichalex16:10:06

they update existed

misha16:10:21

even with :default-value instead of :value?

savelichalex16:10:37

with default value thay not update anything

savelichalex16:10:08

of course if you not update defaultValue

misha16:10:27

that's the thing: if you use default-value instead of value - input does not lag, when you type too fast

savelichalex17:10:22

that's right, because things happened in native side and nothing going through bridge

savelichalex17:10:40

exclude change event

savelichalex17:10:56

there is not re-render