Fork me on GitHub
#fulcro
<
2018-02-27
>
tony.kay00:02:07

Fulcro 2.3.0 is on Clojars. This is a relatively big release, which includes a number of refinements. The version number change reflects that some internal work went on, and that upgrading should include a heightened amount of testing to check for problems. There are also a few minor things that you should be aware of: - The very recently released websockets improvements have a minor API change. This is a source-level break, but it was released so recently few people should be using it yet. - Fulcro Inspect requires an upgrade: Use the latest version. The old version will crash, since it relied on some internals of networking that have evolved. The primary additions in this release are: 1. The addition of a new and improved Remote protocol to support new features: - The new remote supports: aborting requests, getting progress updates, and defining new remotes via middleware instead of low-level network programming. 2. Cleaning up the code so it is easier to use Fulcro with React Native For the time being, the default remoting for client is still the old stuff. The developer’s guide shows how to use the new stuff.

wilkerlucio00:02:47

Fulcro Inspect 2.0.0-alpha6 is on Clojars:

- Compatibility with new Fulcro `FulcroRemoteI` protocol (Fulcro 2.3+)
- Fix multi-app selector bug related to normalization.
- Fix iframe subtree unmount
- Performance improvement: don't render react tree when inspect is inactive
- Performance improvement: limit number of inline items rendered via map

tony.kay02:02:48

I’m working on new i18n stuff to replace to old. Anyone that uses the i18n support (or is interested in it) can comment. My intention is to make the new API as compatible with the old from a UI standpoint as possible. I want to get rid of the need for dynamic code loading (done, load as data from server), a hard dependency on Yahoo formatjs (done, it is now pluggable), and get rid of globals (done) so multiple apps can co-exist on a page. The API isn’t complete, but the internal features are laid out and working. They are on develop, including a card demonstrating almost everything. https://github.com/fulcrologic/fulcro/blob/develop/src/cards/fulcro/democards/i18n_alpha_cards.cljs https://github.com/fulcrologic/fulcro/blob/develop/src/main/fulcro/alpha/i18n.cljc

tony.kay02:02:28

feedback is welcome. I’m going to release this in that new namespace (fulcro.alpha.i18n) so the people will be able to port to the new with an “out” if it is broken in any way.

claudiu12:02:04

Sounds really nice. Haven't reached the point of implementing i18n but was wondering about yahoo formatjs hard dependency 🙂

tony.kay06:02:10

I’ve released 2.3.1-SNAPSHOT to clojars with new i18n support. Developer’s Guide has been updated. It’s a big improvement, I think: http://book.fulcrologic.com/#I18NAlpha

pedrorgirardi08:02:46

It doesn’t seem to be a Fulcro error though, but something Fulcro Inspect.

claudiu08:02:52

did you upgrade to the latest fulcro inspect ?

pedrorgirardi08:02:56

Hi @claudiu, I’m using 2.0.0-alpha5. don’t know if it’s the last version though

claudiu08:02:57

hi, think it needs to be 2.0.0-alpha6 🙂

pedrorgirardi08:02:59

Same error 😞

cjmurphy08:02:29

For the time being you can remove Fulcro Inspect from :preloads and (reload-config).

pedrorgirardi08:02:04

I’m using Java 8 too.

pedrorgirardi08:02:26

I updated ClojureScript to 1.10.64

pedrorgirardi08:02:40

…and Fulcro to 2.3.0

pedrorgirardi08:02:18

@cjmurphy I will try to remove it from :preloads

pedrorgirardi08:02:23

Where is (reload-config)?

cjmurphy08:02:47

Oh that is if you have a Figwheel REPL open.

pedrorgirardi08:02:30

@cjmurphy without the :preload config there is no error, but no Fulcro Inspect either 🙂

cjmurphy08:02:38

When in doubt lein clean...

cjmurphy08:02:40

No you can always put it back in tomorrow when the issue has been fixed.

pedrorgirardi08:02:23

Okay then. Thanks!

maridonkers08:02:45

ClojureScript 1.10.64? Latest stable release: 1.9.946, do you need newer?

cjmurphy08:02:21

If you really want to see a tool use this one instead: https://github.com/chrismurrph/default-db-format

cjmurphy09:02:47

It doesn't depend on Fulcro Inspect, even thou the docs assume you will already have Fulcro Inspect.

pedrorgirardi09:02:07

I didn’t know about default-db-format, thanks @cjmurphy. I’m not in a rush, so I will stick with Fulcro Inspect, just would like to know what is causing the error.

cjmurphy10:02:07

I'm sure it will be fixed soon. default-db-format is not an alternative, it does a different job. I wrote it to save headaches when mutations stuff up your state.

pedrorgirardi09:02:30

@maridonkers you’re right, the problem seems to be with ClojureScript 1.10.64

pedrorgirardi09:02:12

The ClojureScript 1.10.64 version was just released (but doesn’t seem to be a ‘stable’ version), but I didn’t expect it to “break things”.

maridonkers09:02:38

Released as a stable version? The site doesn't (yet) mention it: https://clojurescript.org/news/news

pedrorgirardi09:02:43

You’re right, probably not a stable release.

maridonkers09:02:01

Had lots of weird problems (in the past, not Fulcro related) when I updated library versions in existing projects. Nowadays I'm more reluctant to do so.

pedrorgirardi09:02:50

It’s probably a good idea, but I usually don’t hesitate to upgrade ClojureScript. Thanks for your help!

wilkerlucio13:02:07

seems like they are still testing, so you just found a problem 🙂 https://clojurians.slack.com/archives/C03S1L9DN/p1519733217000372

pedrorgirardi14:02:00

Thanks @wilkerlucio. I will report to Mike Fikes then.

donmullen18:02:22

Doing something fundamentally wrong here - but not quite sure (brain tired) :

(defmutation update-property-detail
  "Mutation: Update Property Detail Page to point to current property"
  [{:keys [bbl]}]
  (action [{:keys [state] :as env}]
    (do
      (let [current-property (get-in @state [:current-property])]
        #?(:cljs (js/console.log "current property: " current-property))
        (swap! state assoc-in [:property :singleton :ps/property] current-property)))))
was expecting current-property to be something like [:property/by-bbl 4042940013] - but I’m getting a map {:ui/fetch-state {:fulcro.client.impl....}

magra18:02:33

When I enter a String with german letters like "Süße Höhe" in the webclient it shows up in inspect in the db ok. It gets to the server ok and into server storage ok. When I read it (as in read.clj server read) the server seems to send it ok. The browser shows the xhr json to be ok. But then the correct string in the client db gets replaced by "S��e H�he".

magra18:02:26

Html on the page renders ok. Maps that the server sends generated with defquery-entity and defquery-root show up in browser inspector as json ok but end up in the app database corrupt.

myguidingstar18:02:38

hi all, I’m finalizing walkable, my library for writing fulcro server with sql db https://github.com/walkable-server/walkable it shares the scope with fulcro-sql and is based on pathom examples are in the project’s readme it comes with a Duct framework setup and a tiny fulcro client app for demonstration purpose your feedback is most welcome

tony.kay19:02:38

You’re using a non-standard query notation for your join:

[{(:k params) subquery}]
We added support to this as of version 2.2.1 or something, but if you put that on a UI query and use db->tree on it (which is common in client parsers) in Om or older versions of Fulcro it will crash. Probably deserves either a note or use the older standard syntax. This was a hole in the AST definition of Om. Not sure if it was intentional, but it will break people in an unexpected way if they use it without knowing that,.

tony.kay19:02:23

BTW, I’d love to make fulcro-sql eventually depend on this if you get it polished. I think the database component, seeding, migrations, and testing are all good in it, but the query stuff is too light, and I don’t have time to make it better. Your solution seems quite good, assuming performance is good.

myguidingstar02:02:41

yeah, I'm working on the N+1 optimization. That's why it's not on clojars yet 🙂

myguidingstar03:02:40

i've just pushed a note on the query params syntax. Thanks

tony.kay19:02:28

@donmullen sounds like your state isn’t normalized

tony.kay19:02:39

you’re seeing a load marker, so perhaps your mutation is running while a load is still active (or after it failed)? You can always set :marker false on you load to avoid load markers: (load .... {:marker false})

cjmurphy19:02:58

@donmullen Seems like your state has become de-normalized somehow. These kinds of bugs can take a while to track down. That's why there's a tool that will watch your state changes and let you know when the problem occurred: https://github.com/chrismurrph/default-db-format

tony.kay19:02:15

@magra could be a bug. I’m using transit and such underneath…you might check for decoding bug reports there

tony.kay19:02:54

there are all sorts of places for character encodings to go south

tony.kay19:02:26

sounds like you’ve isolated it to the client…you sure your browser is using UTF-8 as the encoding to display?

donmullen19:02:37

@tony.kay @cjmurphy - thanks - yes a load was happening. Will check out default-db-format.

tony.kay19:02:53

@myguidingstar Curious on your SQL walking: Are you optimizing the number of queries, or just hitting the tables as you reach them in the graph walk?

magra19:02:01

@tony.kay I have <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> set, display some of those letters in (defsc (dom/div)) Elements to check and entered the text in an input field. Is there someplace else I need to set/check?

tony.kay19:02:30

then you could play with the browser and make sure it isn’t an artifact there. That would narrow it down to a possible transit bug.

myguidingstar19:02:11

@tony.kay thanks for pointing it out. I've planned similar optimization when studying fulcro-sql, somehow forget it. I've been refactoring walkable's internal to be more data driven (just finished today) so further optimizations won't make the code smell 😄

magra19:02:50

@tony.kay it happens in chrome and in firefox and the picker does not change the result. The xhr request has Content-Type: application/transit+json, no mention of the encoiding. Is this ok?

magra19:02:28

Hi all! Could someone please look at your xhr networkrequest to the fulcro api and tell me what the Content-Type in the server response should be. I am especially interested in whether it contains characterset encoding information, since mine does not.

wilkerlucio19:02:42

@magra I have this: Content-Type:application/transit+json, no encoding there, and I use UTF-8 chars (latin accents like é, ç, ú...)

wilkerlucio20:02:41

in full (removed just the actual urls)

Response Headers
Access-Control-Allow-Credentials:true
Access-Control-Expose-Headers:X-Frame-Options, Access-Control-Allow-Origin, X-Xss-Protection, X-Download-Options, Strict-Transport-Security, X-Permitted-Cross-Domain-Policies, Access-Control-Allow-Credentials, Access-Control-Expose-Headers, X-Content-Type-Options, Content-Security-Policy, Content-Type
Content-Security-Policy:object-src 'none'; script-src 'unsafe-inline' 'unsafe-eval' 'strict-dynamic' https: http:;
Content-Type:application/transit+json
Strict-Transport-Security:max-age=31536000; includeSubdomains
Transfer-Encoding:chunked
X-Content-Type-Options:nosniff
X-Download-Options:noopen
X-Frame-Options:DENY
X-Permitted-Cross-Domain-Policies:none
X-XSS-Protection:1; mode=block

Request Headers
Accept:*/*
Accept-Encoding:gzip, deflate, br
Accept-Language:en-US,en;q=0.9,pt-BR;q=0.8,pt;q=0.7
Cache-Control:no-cache
Connection:keep-alive
Content-Length:146
Content-Type:application/transit+json
Pragma:no-cache
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36

tony.kay20:02:46

I’ve updated the new i18n with SSR support, and udpated the dev guide to explain how to do that. This also allows you to establish dynamic i18n contexts for different parts of the rendering, though I’m not sure that is particularly useful. Useful for things like previewing one part of the UI in one locale while working in another.

tony.kay20:02:05

also devcards, now that I think of it

tony.kay20:02:17

sweet…added a feature without knowing it 😜

tony.kay20:02:00

If anyone is interested in donating some time, it would sure be nice to update the TODO MVC and fulcro-template to use the new i18n support. It would really help me out. PM me if you have the time/interest to do so.

tony.kay20:02:58

This new support also makes it really easy to add a “dev tool” that lets you do i18n translations right in the UI…that is on the TODO list, but if anyone wants to give that a shot I’d be glad to frame it out for you.

tony.kay20:02:32

imagine mutating the translation right back to the server and directly updating the PO file 🙂 No more “translator wrote something too large to fit in the UI!“…they’d see it in real time.

mitchelkuijpers20:02:05

I want to take up that live translating! we talked about that before ;-)

wilkerlucio20:02:21

about the translation editor tool, this can be a new tool, but could also be part of fulcro-inspect, what you guys think?

mitchelkuijpers20:02:36

Might be cool for fulcro inspect?

wilkerlucio20:02:47

I think so, considering that i18n is native from fulcro

mitchelkuijpers20:02:58

Lol was typing the same thing

wilkerlucio20:02:02

could be a new tab 🙂

mitchelkuijpers20:02:12

Yeah let's create a ticket in fulcro inspect for this? We could sketch it out there

tony.kay20:02:49

funny, I just created a ticket that said the same thing

mitchelkuijpers20:02:58

Currently on my phone, will look at it tomorrow

tony.kay20:02:06

great! Thanks

mitchelkuijpers20:02:14

Guess we are all on the same page

tony.kay20:02:15

feel free to move the ticket

tony.kay20:02:35

I’ll add a bit more detail to it to make it easier to get going on

wilkerlucio20:02:36

@mitchelkuijpers let me know if you need any help with inspect impl details 😉

ordnungswidrig22:02:51

What are possible reasons that (prim/get-computed this) is nil even though I call the factory like this (ui-come-somponent (prim/computed some-props {:foo 123}))?

wilkerlucio22:02:15

@ordnungswidrig you must call get-computed on the props, eg: (-> this prim/props prim/get-computed)

wilkerlucio22:02:00

if you use defsc it can give you in a easier way 😉

ordnungswidrig22:02:14

I’m using it but either way it’s nil

wilkerlucio22:02:47

weird, the computed are just part of the props

wilkerlucio22:02:53

can you post more of this chain?

ordnungswidrig22:02:17

trying a clean build first

ordnungswidrig22:02:03

btw. the docs suggest to use (prim/get-computed this :onDelete) (4.5.2 http://book.fulcrologic.com/#_render_and_props)

ordnungswidrig22:02:18

I’ve removed state and query declarations, these work.

wilkerlucio22:02:36

@ordnungswidrig cant check right now, later I can try and get you back

ordnungswidrig22:02:15

cool, I might be still around. If not I’ll sure I’ll figure it out. Thanks for helping anyways.

ordnungswidrig23:02:11

@wilkerlucio ok I found the error. I call the factory like this (ui-some-component (prim-computed a-list-value {:foo 123})), passing in a vector as the props, not {:list a-list-value}

wilkerlucio23:02:12

oh, glad you figure, and calling stateful components with lists is a no no, if it has a query you should call it with a map

wilkerlucio23:02:50

the parent should do the map (or some helper in the middle), but I guess you now realized that :)

ordnungswidrig23:02:12

yes! I wonder if defsc should provide a warning or like that.

wilkerlucio23:02:31

I guess the dificulty is that this has to be checked on call time, adding this kind of code on the fw can add overhead that we usually avoid

ordnungswidrig23:02:12

that’s right. this is maybe something for a “dev” mode or like that. Anyways, wrapping it up for today.

wilkerlucio23:02:33

an assert might work actually