Fork me on GitHub
#shadow-cljs
<
2019-09-11
>
Jon03:09:53

does it affect shadow-cljs' built in HTTP server?

thheller14:09:13

the server already sets SameSite=strict?

Jon16:09:14

in Chrome Canary. when it's not set, it defaults to Lax.

Jon16:09:33

Chrome stable should be fine at current. But it will upgrade soon I think.

Jon16:09:55

not sure the time Chrome turn on it for all websites. I think that would affect quite some sites.

Jon16:09:21

sorry I didn't see the notification earlier..

thheller16:09:21

the cookie is already set so we should be fine

Jon17:09:45

no waring now in 0.8.53. cool

Jon03:09:31

Chrome Canary has this issue. Although it affects on cookies mostly. Just feel quite annoying

gleisonsilva14:09:33

Hey guys! May you can help me... I'm not able to got a React component working with Shadow-cljs... I think it may something with the way I need to import... On the samples, the import is made that way:

import * as WebDataRocksReact from './webdatarocks.react';
The package, on NPM, is just "webdatarocks". I did the import this way:
["webdatarocks" :as wdr]
But when I try to use this component, I get an error "Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for"... In the component's doc, I should do
<WebDataRocksReact.Pivot />
In clojurescript I can't figure out how to instantiate... I've tried thinks like
[:> wdr/Pivot {}]
or
[:> wdr/WebDataRocksReact {}] 
None works...

gleisonsilva14:09:03

I think this "." (dot) in import as well on component name is what troubles me...

thheller14:09:33

@gleisonsilva try shadow-cljs browser-repl and then (require '["webdatarocks" :as wdr]) + (js/console.dir wdr)

thheller14:09:51

in the browser console you should see the object and inspect it further

thheller14:09:07

if there is a Pivot property then wdr/Pivot should work

gleisonsilva14:09:39

Hey @thheller, there isn't...

thheller14:09:10

hmm thats just a function

thheller14:09:18

do you maybe need to instantiate it?

gleisonsilva14:09:09

Do you have some suggestion on how can I instantiate it?

thheller14:09:53

this isn't in the npm package so I guess they expect you to write this yourself?

thheller14:09:06

probably best to skip the JS version and just write it directly in reagent

thheller14:09:21

componentDidMount() {
			var config = {};
			config.container = ReactDOM.findDOMNode(this);
			this.parseProps(config);
			this.webdatarocks = new window.WebDataRocks(config);
		}

thheller14:09:26

this seems to be the relevant part

gleisonsilva14:09:32

Right. I'll try! Thk u very much!

gleisonsilva14:09:28

@thheller looking through the code, I can see that the webdatarocks.js has the react parts

gleisonsilva14:09:50

There is a way to import like in the example, like "webdatarocks.react"??

thheller14:09:51

yuck

😂 4
thheller14:09:19

the ./webdatarocks.react import is a local import

thheller14:09:23

it is not in the npm package

thheller14:09:48

but it appears to export those to a global object if the global React exists

thheller14:09:25

which is bad practice. the package in general doesn't seem very high quality

thheller14:09:41

import * as WebDataRocksReact from './webdatarocks.react'; is just importing ./webdatarocks.react.js relative to the App.js

thheller14:09:34

you can maybe access js/WebDataRocksReact if there is a global js/React (which there normally isn't)

gleisonsilva14:09:34

Got it. I'll try the other way so...