Fork me on GitHub
#shadow-cljs
<
2018-06-09
>
richiardiandrea00:06:13

solved, opened a PR for the error

lilactown15:06:30

I’m working on a bunch of macro stuff right now in CLJ-land, and I’m having trouble getting shadow-cljs to pick up my changes

lilactown16:06:27

atm I have a dependency tree something like

workshop.cljs
 |
 -> react.cljs
    |
    -> react.clj
       |
       -> compiler/core.clj
          |
          -> compiler/parser.clj
          |
          -> compiler/analyzer.clj
          |
          -> compiler/generator.clj

lilactown16:06:41

changes to react.clj trigger a recompile/hot load, but changes to transitive dependencies (e.g. compiler/core.clj or beyond) do not trigger a recompile and seem to require a restart to pick up changes

thheller16:06:06

.clj files are never followed

thheller16:06:11

only the initial one counts

thheller16:06:38

why not just develop the macros at the REPL?

thheller16:06:55

CLJ REPL I mean

lilactown16:06:05

I did initially just work in a CLJ repl on the compiler, but there’s some hairiness that I’m trying to diagnose that I’m not seeing in my REPL

thheller16:06:57

I guess the macro tracking could be improved but would be a bit of work

lilactown16:06:25

yeah. I guess I was just wondering if there was a way that I could get it to reload without restarting the shadow-cljs process?

lilactown16:06:41

would reloading at the REPL work?

thheller16:06:09

use the REPL. literally the only reason to restart is changing dependencies, nothing else requires a restart

thheller16:06:58

won't have much time to work on anything shadow-cljs related the next few weeks

thheller16:06:04

but open a ticket so it doesn't get lost

lilactown16:06:25

ok np. I appreciate all the help 😄

richiardiandrea16:06:56

@lilactown (require-macros ns : reload) or :reload-all should work. It usually reads the source on disk and loads it

thheller16:06:22

require-macros isn't actually supported currently

richiardiandrea16:06:50

So does that mean that shadow cannot compile vanilla cljs code? I am asking because I wanted to use it in an existing project

richiardiandrea16:06:12

Or not supported at the REPL only?

thheller16:06:59

(require-macros ..) iis a REPL only thing

thheller16:06:00

:require-macros is fully supported

thheller16:06:00

two very different things though

richiardiandrea16:06:43

Well... implementation might be different...but they kind of do the same thing no?

richiardiandrea16:06:26

From a user of the language perspective what is the difference?

thheller16:06:39

I don't know what you are asking

thheller16:06:14

if you want (require-macros 'the.macro :reload-all) literally just open a CLJ REPL and (require 'the.macro :reload-all)

thheller16:06:40

:require-macros in the ns is metadata

thheller16:06:49

it does absolutely nothing by itself

richiardiandrea16:06:12

Metadata always does something or it wouldn't be there in the first place

thheller16:06:42

yes ... it will cause the compiler to load the macro ns. in that sense they achieve the same thing

thheller16:06:15

what I mean thought is that require-macros actually evals code

thheller16:06:47

:require-macros does nothing until the compiler is actually ready to do something

thheller16:06:55

so everything happens at a different time and stuff

thheller16:06:31

trivial to add

thheller16:06:51

the only reason require-macros isn't supported is because I have never needed it

👍 4
thheller16:06:52

feel free to open a ticket if you want it

thheller16:06:28

to me macros are clojure code so I develop them at a clojure REPL. might just be me though

mj_langford17:06:51

How many people are using shadow-cljs for backend node based servers?

richiardiandrea17:06:25

@mj_langford I have just started that

richiardiandrea17:06:40

Some bumps with cider, but the rest is pretty good

lilactown18:06:32

We've been using it at work for about 4 months now

lilactown18:06:36

Pretty solid

mj_langford19:06:33

Is this the "goto" page you use for imports from JS codebases? https://shadow-cljs.github.io/docs/UsersGuide.html#_using_npm_packages

jefffriesen23:06:47

Hi. Has anyone gotten a react virtualized component working with a direct npm import like shadow-cljs recommends? There’s the start of an example but it doesn’t quite go far enough… https://shadow-cljs.github.io/docs/UsersGuide.html#_using_npm_packages

jefffriesen23:06:57

I’m trying to get something rendering like this:

import React from 'react';
import ReactDOM from 'react-dom';
import { Column, Table } from 'react-virtualized';
import 'react-virtualized/styles.css'; // only needs to be imported once

// Table data as an array of objects
const list = [
  { name: 'Brian Vaughn', description: 'Software engineer' }
  // And so on...
];

// Render your table
ReactDOM.render(
  <Table
    width={300}
    height={300}
    headerHeight={20}
    rowHeight={30}
    rowCount={list.length}
    rowGetter={({ index }) => list[index]}
  >
    <Column
      label='Name'
      dataKey='name'
      width={100}
    />
    <Column
      width={200}
      label='Description'
      dataKey='description'
    />
  </Table>,
  document.getElementById('example')
);

jefffriesen23:06:03

Here’s mine:

(ns simple.virtual-table
  (:require ["react-virtualized" :refer (Table Column)]))
(enable-console-print!)

(def rows
  [{:name "brian vaughn" :description "one"}
   {:name "brian vaughn" :description "two"}
   {:name "brian vaughn" :description "three"}
   {:name "brian vaughn" :description "four"}
   {:name "brian vaughn" :description "five"}
   {:name "brian vaughn" :description "six"}])


(defn react-virtualized-table []
  [:div
   [:h3 "React Virtualized Table"]
   [:> Table {:headerHeight 30
              :height 300
              :rowCount 5
              :rowGetter (fn [m] 
                            (get rows (aget m "index")))
              :rowHeight 50
              :width 400
              }
      [:> Column {:label "Name"
                  :dataKey "name"
                  :width 100}]
      [:> Column {:label "Description"
                  :dataKey "description"
                  :width 100}]
    ]])

jefffriesen23:06:39

I get the table rendering with rows and columns, but the columns empty

jefffriesen23:06:17

<div class="ReactVirtualized__Table__rowColumn" role="gridcell" title="" style="flex: 0 1 100px; overflow: hidden;"></div>

jefffriesen23:06:10

Anyone have luck with this? All examples online (for most npm components) use cljsjs like this one: https://gist.github.com/crankyadmin/cd2a22ecfe4068a94e6800f5a9349811