This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-07-16
Channels
- # aws (17)
- # babashka (2)
- # beginners (131)
- # bristol-clojurians (1)
- # calva (16)
- # chlorine-clover (6)
- # cider (10)
- # clara (5)
- # cljsrn (82)
- # clojure (176)
- # clojure-dev (14)
- # clojure-europe (13)
- # clojure-italy (13)
- # clojure-nl (4)
- # clojure-spec (10)
- # clojure-sweden (32)
- # clojure-uk (32)
- # clojuredesign-podcast (2)
- # clojurescript (34)
- # community-development (2)
- # conjure (17)
- # cursive (4)
- # datomic (51)
- # emacs (6)
- # figwheel-main (26)
- # fulcro (16)
- # graalvm (11)
- # jobs (2)
- # jobs-discuss (30)
- # kaocha (4)
- # meander (23)
- # off-topic (34)
- # pathom (5)
- # re-frame (10)
- # reagent (3)
- # reitit (6)
- # releases (3)
- # sci (36)
- # shadow-cljs (27)
- # sql (9)
- # testing (6)
- # tools-deps (28)
- # vim (8)
Pretty sure there are other similar issues to come.
@U064J0EFR 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: "",
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,
() => 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&fwbuild=ios"}
If I manually change the “localhost” to local ip in the generated output it all works
ios.cljs.edn
^{:react-native :cli
:connect-url ""
:clean-ouputs true}
{:main rf.shared.main}
(I’ve been using the figwheel https://github.com/bhauman/react-native-figwheel-bridge so just trying to migrate)
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
If I just stick to “localhost” everywhere and open the simulator on the local computer it all loads
I have to change it in two locations: index.js target/public/cljs-out/ios/cljsc_opts.json
Change the
{"figwheel.repl.connect_url":"ws:\/\/localhost:9500\/figwheel-connect?fwprocess=34417a&fwbuild=ios"}
And the ios.cljs.edn currently is:
^{:react-native :cli
:connect-url ""
:clean-outputs true}
{:main rf.shared.main}
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”
If I delete all the IP-related config, it all goes to localhost and it works on the simulator on the laptop
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
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"}}
@olivergeorge thanks for looking into will take a look later today
@dnolen this might justify bumping tcp socket too. https://github.com/Rapsssito/react-native-tcp-socket/issues/54
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?
Good question. I’m interested to see what answers you get. SQLite and AsyncStorage are good conservative options.
@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
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
DataScript + serializing is nice but if you have lots of data it can be slow and cause UX issues.
@olivergeorge What size data have you gotten to where it’s slow?
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.
The reference data was every site, building, room and floor of a university we work with.
When someone works out how to put datascript in front of SQLite I'll be very interested.
Gotcha. I’m in the 100s of KB without running into issues, so nowhere close.
I should test it to see where it starts becoming an issue.
Yep, remember you probably test on fast devices & simulators too
Yeah, good point.
We put some logging on the re-frame handlers doing the work.