cljsrn

https://github.com/drapanjanas/re-natal | https://github.com/drapanjanas/re-natal/wiki/FAQ | https://github.com/condense/mercury-app/wiki | https://github.com/seantempesta/expo-cljs-template/ https://www.npmjs.com/package/create-expo-cljs-app
Oliver George 2020-07-16T06:56:28.044300Z

https://github.com/vouch-opensource/krell/issues/98

⚒️ 1
Oliver George 2020-07-16T06:57:30.045300Z

Pretty sure there are other similar issues to come.

bhauman 2020-07-16T13:27:11.048400Z

@raspasov just set the :connect-url

dnolen 2020-07-16T14:50:56.048800Z

@olivergeorge thanks for looking into will take a look later today

Oliver George 2020-07-16T19:38:41.049600Z

@dnolen this might justify bumping tcp socket too. https://github.com/Rapsssito/react-native-tcp-socket/issues/54

Luca 2020-07-16T20:22:36.050800Z

Hi guys what is the best practice when it comes to saving user input and saving it? e.g. a person writing a todo in the app storage and persisting it?

Oliver George 2020-07-16T20:26:49.052100Z

Good question. I’m interested to see what answers you get. SQLite and AsyncStorage are good conservative options.

raspasov 2020-07-16T21:11:02.052200Z

@bhauman I tried that, it doesn’t seem to get used in the generated index.js, it defaults to “localhost”; I have figwheel-main.edn like:

{:ring-server-options {:port 9500 :host "192.168.1.62"}}
… and ios.cljs.edn like:
^{:react-native :cli} 
{:main rf.shared.main}
So in that case when I launch the repl I get: [Figwheel] Starting Server at http://192.168.1.62:9500 But in the index.js I still get “localhost”:
import {npmDeps} from "./target/public/cljs-out/ios_rn/npm_deps.js";
import {assets} from "./target/public/cljs-out/ios/krell_assets.js";
import {krellNpmDeps} from "./target/public/cljs-out/ios/krell_npm_deps.js";
var options = {optionsUrl: "<http://localhost:9500/cljs-out/ios/cljsc_opts.json>",
               autoRefresh: true};
var figBridge = require("./target/public/cljs-out/ios_rn/figwheel-bridge.js");
figBridge.shimRequire({...assets, ...krellNpmDeps, ...npmDeps});
import {AppRegistry} from 'react-native';
import {name as appName} from './app.json';
AppRegistry.registerComponent(appName,
                              () =&gt; figBridge.createBridgeComponent(options));
In the generated output under /target/public/cljs-out/ios/cljsc_opts.json there’s also:
{"figwheel.repl.connect_url":"ws:\/\/localhost:9500\/figwheel-connect?fwprocess=93622e&amp;fwbuild=ios"}

bhauman 2020-07-16T21:12:40.052400Z

no the :connect-url set that

bhauman 2020-07-16T21:12:48.052600Z

in your cljs.edn

bhauman 2020-07-16T21:13:11.052800Z

@raspasov ^

raspasov 2020-07-16T21:13:19.053Z

ah, the ios.cljs.edn ?

raspasov 2020-07-16T21:13:33.053200Z

Thanks for looking into this, I feel like I’m missing something obvious 🙂

bhauman 2020-07-16T21:14:11.053400Z

<ws://192.168.1.62:9500/figwheel-connect>

bhauman 2020-07-16T21:14:18.053600Z

:connect-url

raspasov 2020-07-16T21:14:51.053800Z

^{:react-native :cli
  :connect-url "<ws://192.168.1.62:9500/figwheel-connect>"}
{:main rf.shared.main}

bhauman 2020-07-16T21:15:03.054Z

yeah that should work

raspasov 2020-07-16T21:15:05.054200Z

Like that? I believe I tried that, but I’ll try again

bhauman 2020-07-16T21:15:17.054400Z

yeah

bhauman 2020-07-16T21:15:30.054600Z

also make sure that the compile is completing

raspasov 2020-07-16T21:15:41.054800Z

It is…

raspasov 2020-07-16T21:16:16.055Z

If I manually change the “localhost” to local ip in the generated output it all works

bhauman 2020-07-16T21:16:33.055200Z

actually it should pick up the :host option

bhauman 2020-07-16T21:17:12.055400Z

do me a favor and set :clean-ouputs true

raspasov 2020-07-16T21:17:16.055600Z

Yea, it’s strange, it doesn’t pick it up with this either:

raspasov 2020-07-16T21:17:38.056Z

no problem, trying

raspasov 2020-07-16T21:17:57.056200Z

ios.cljs.edn

^{:react-native :cli
  :connect-url "<ws://192.168.1.62:9500/figwheel-connect>"
  :clean-ouputs true}
{:main rf.shared.main}

raspasov 2020-07-16T21:18:00.056400Z

Like that?

bhauman 2020-07-16T21:18:16.056600Z

yep

raspasov 2020-07-16T21:18:19.056800Z

^{:react-native :cli
  :connect-url "<ws://192.168.1.62:9500/figwheel-connect>"
  :clean-outputs true}
{:main rf.shared.main}

raspasov 2020-07-16T21:18:25.057Z

(corrected spelling)

bhauman 2020-07-16T21:18:29.057200Z

that way it deletes everything

bhauman 2020-07-16T21:18:37.057400Z

and recompiles from scratch

raspasov 2020-07-16T21:18:49.057600Z

kk 1 sec

bhauman 2020-07-16T21:19:11.057800Z

wait are you on the latest version?

bhauman 2020-07-16T21:19:16.058Z

0.2.10?

raspasov 2020-07-16T21:19:38.058200Z

raspasov 2020-07-16T21:19:46.058600Z

Yes, 0.2.10

bhauman 2020-07-16T21:20:18.058800Z

and the index.js still has the wrong address in it?

raspasov 2020-07-16T21:20:27.059Z

(I’ve been using the figwheel https://github.com/bhauman/react-native-figwheel-bridge so just trying to migrate)

raspasov 2020-07-16T21:21:00.059400Z

yes, localhost 😞

bhauman 2020-07-16T21:21:36.059600Z

well that’s weird going to check it now

raspasov 2020-07-16T21:21:38.059800Z

It’s not the biggest of issues; something weird with how the config get read… I tried looking through the source code but couldn’t quite make sense of it all

raspasov 2020-07-16T21:21:50.060Z

source code of how the index.js gets written

raspasov 2020-07-16T21:22:25.060200Z

If I just stick to “localhost” everywhere and open the simulator on the local computer it all loads

raspasov 2020-07-16T21:22:47.060400Z

So everything is working, it seems like a simple config issue….

raspasov 2020-07-16T21:23:10.060600Z

(Same if I change to the IP manually and reload on the device - it works)

raspasov 2020-07-16T21:23:55.060800Z

I have to change it in two locations: index.js target/public/cljs-out/ios/cljsc_opts.json

raspasov 2020-07-16T21:24:09.061Z

Change the

{"figwheel.repl.connect_url":"ws:\/\/localhost:9500\/figwheel-connect?fwprocess=34417a&amp;fwbuild=ios"}

bhauman 2020-07-16T21:25:19.061200Z

yeah do you have a figwheel.edn?

raspasov 2020-07-16T21:25:48.061400Z

figwheel-main.edn ?

raspasov 2020-07-16T21:25:51.061600Z

{:ring-server-options {:port 9500 :host "192.168.1.62"}
 }

bhauman 2020-07-16T21:25:54.061800Z

yeah

raspasov 2020-07-16T21:26:16.062Z

That’s it

raspasov 2020-07-16T21:26:35.062200Z

And the ios.cljs.edn currently is:

^{:react-native :cli
  :connect-url "<ws://192.168.1.62:9500/figwheel-connect>"
  :clean-outputs true}
{:main rf.shared.main}

raspasov 2020-07-16T21:27:47.062400Z

I tried different options, deleting the figwheel-main.edn; putting all the config in ios.cljs.edn - it changes the IP when it says: [Figwheel] Starting Server at http://192.168.1.62:9500 But in the react-native generated files, keeps defaulting to “localhost”

bhauman 2020-07-16T21:28:15.062600Z

cool I’m looking at it now

👍 1
raspasov 2020-07-16T21:28:16.062800Z

If I delete all the IP-related config, it all goes to localhost and it works on the simulator on the laptop

bhauman 2020-07-16T21:28:51.063100Z

OK I’m getting the same behavior

bhauman 2020-07-16T21:28:58.063300Z

maybe I lost a commit

bhauman 2020-07-16T21:31:40.063600Z

found the bug

bhauman 2020-07-16T21:31:46.063800Z

it was a refactor bug

bhauman 2020-07-16T21:31:49.064Z

sorry about that

raspasov 2020-07-16T21:32:00.064200Z

No worries, thanks so much for looking into it so fast 🙂

bhauman 2020-07-16T21:32:11.064400Z

should have just taken your work for it

raspasov 2020-07-16T21:32:41.064600Z

No problem, glad we could re-produce

raspasov 2020-07-16T21:37:14.066200Z

@luca.cambiaghi for non-encrypted storage AsyncStorage works well; for encrypted stuff I’ve used https://github.com/oblador/react-native-keychain and that’s a nice to use library also

raspasov 2020-07-16T21:41:05.068200Z

Not sure about the limitation of storing huge blobs of todo in keychain; perhaps AsyncStorage is the way to go; another Clojure-style option would be writing to DataScript and serializing it to disk

bhauman 2020-07-16T21:49:45.068300Z

0.2.11-SNAPSHOT is pushed with the change, it supports :host and connect-url , use host when you want to set the server’s listening ip, use :connect-url when you are connecting to a different address than your local one

🦜 1
bhauman 2020-07-16T21:50:10.068500Z

it will be deployed after the tests run

raspasov 2020-07-16T21:53:07.068800Z

Thank you! 🙂

raspasov 2020-07-16T21:57:10.069Z

Just tried it, seems to work! 🙂 IPs are set correctly in index.js and cljsc_opts.json based on

{:ring-server-options {:port 9500 :host "192.168.1.62"}}

👍 1
Oliver George 2020-07-16T22:25:49.069900Z

DataScript + serializing is nice but if you have lots of data it can be slow and cause UX issues.

joshmiller 2020-07-16T23:09:24.070800Z

@olivergeorge What size data have you gotten to where it’s slow?

Oliver George 2020-07-16T23:15:06.073300Z

It was a while back and we've moved on from that approach. SQLite is less convenient but it means we're not holding lots of memory or trying to serialize/deserialize large amounts of data. The SQLite DB we package with the app is 1.8M.

Oliver George 2020-07-16T23:15:35.073900Z

The reference data was every site, building, room and floor of a university we work with.

Oliver George 2020-07-16T23:16:32.074700Z

When someone works out how to put datascript in front of SQLite I'll be very interested.

joshmiller 2020-07-16T23:16:49.075Z

Gotcha. I’m in the 100s of KB without running into issues, so nowhere close.

joshmiller 2020-07-16T23:16:59.075400Z

I should test it to see where it starts becoming an issue.

Oliver George 2020-07-16T23:17:15.075800Z

Yep, remember you probably test on fast devices & simulators too

joshmiller 2020-07-16T23:17:27.076100Z

Yeah, good point.

Oliver George 2020-07-16T23:17:40.076500Z

We put some logging on the re-frame handlers doing the work.