This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-11-17
Channels
- # aleph (4)
- # announcements (2)
- # babashka (85)
- # beginners (136)
- # calva (72)
- # clj-commons (32)
- # clj-kondo (7)
- # cljs-dev (3)
- # clojure (117)
- # clojure-europe (38)
- # clojure-nl (3)
- # clojure-norway (1)
- # clojure-uk (4)
- # clojurescript (19)
- # conjure (38)
- # core-logic (2)
- # cursive (10)
- # datalevin (1)
- # datalog (1)
- # datomic (6)
- # events (2)
- # fulcro (16)
- # google-cloud (5)
- # graphql (10)
- # gratitude (3)
- # hugsql (3)
- # luminus (5)
- # membrane-term (12)
- # missionary (2)
- # nextjournal (5)
- # off-topic (3)
- # pedestal (2)
- # polylith (7)
- # portal (3)
- # re-frame (6)
- # reagent (26)
- # reclojure (8)
- # releases (3)
- # reveal (5)
- # shadow-cljs (14)
- # spacemacs (20)
- # sql (3)
- # tools-build (3)
- # web-security (9)
I need help making a better key for my table elements: https://github.com/pineflowers/treefinder/blob/b1aae5b5b88399b2f5446ffebf8d6fed3064c507/src/app/hello.cljs#L125.
Well… that’s my worry… that I may not have unique values there.
What about those things concatenated with the product of gensym or the equivalent?
Don't use gensym at all, even if concatenated with something.
If you know that some data is unique, use it. If not, try to find or create one. E.g. in this case, since you control the data, you can just assign a unique ID for each entry yourself. A plain int from 0 and up would suffice. Not during rendering but in advance - it should come from the source.
When you can't do that, just don't use sequences for children - for
creates such a sequence here. You could wrap it with e.g. (into [:<>] ...)
.
Sounds solid. I’ll add unique values to each record (that will be the case anyway soon once I move beyond the placeholder data).
I’ve just been informed gensym is not a good approach.
Unrelated observations totally welcome as well.
Hi, I am trying to resolve one issue which I am currently facing. I am following below steps 1. Created a project using `lein new re-frame appname +10x`. Then I installed mui5(CSS framework) https://mui.com/getting-started/installation/ 2. Then I just modified views.cljs like below
(ns demo.views
(:require
["@mui/material/styles" :refer [ThemeProvider, StyledEngineProvider]]
["@sphere/component-library" :refer [themeV2]]
["@sphere/component-library/build/components/v3/Dummy/Dummy" :default Dummy]
["@mui/material/Button" :default Button]
["@mui/material/CssBaseline" :default CssBaseline]))
(defn test-component []
[:<>
[:> Button {:variant "contained"} "MUI Button"]
[:> Dummy]])
(defn main-panel []
[:> StyledEngineProvider {:injectFirst true}
[:> ThemeProvider {:theme themeV2}
[:> CssBaseline]
[test-component]]])
Note: Here `["@sphere/component-library/build/components/v3/Dummy/Dummy" :default Dummy]` is a UI library written in JS react and https://mui.com/getting-started/installation/ only used there
I am getting below error in screenshots:If I do the same in `create-react-app` it works fine without any problem. Here is the code in screenshot:
https://github.com/reagent-project/reagent/blob/master/doc/ReactFeatures.md#function-components
Actually we are already using reagent/reframe and I am already following those thing which you can see in example piece of code. Problem only coming now if I try upgrading mui version to 5 in reagent project. MUI 4 works well. So I am wondering if need some extra configuration. Also: 1. I am able to use mui components directly without any issue. 2. Problem comes if I try to use a UI component library written in React JS. If component in component library is using MUI5 then only error is coming and if it is not using then there is no issue.
thats why I linked you the section about fuinction components. read it. that is the cause of your problem as the error in the console is telling you.
you are mixing libraries. so I'm guessing the @sphere
stuff maybe is meant for an older MUI?
@sphere/component-library
is React JS component library which is using the same MUI 5 version.
Is it related to reagent version? But I already tried to upgrade and it doesn't solve the problem. This is the package.json and shadow-cljs.end deps
{
"name": "demo",
"scripts": {
"ancient": "clojure -Sdeps '{:deps {com.github.liquidz/antq {:mvn/version \"RELEASE\"}}}' -m antq.core",
"watch": "npx shadow-cljs watch app browser-test karma-test",
"release": "npx shadow-cljs release app",
"build-report": "npx shadow-cljs run shadow.cljs.build-report app target/build-report.html",
"link:local": "yarn link @sphere/component-library && yarn link react && yarn link @mui/styles && yarn link @mui/material"
},
"dependencies": {
"@emotion/react": "^11.5.0",
"@emotion/styled": "^11.3.0",
"@mui/icons-material": "^5.1.0",
"@mui/lab": "^5.0.0-alpha.54",
"@mui/material": "^5.1.0",
"@mui/styles": "^5.1.0",
"highlight.js": "11.1.0",
"@sphere/component-library": "v0.1.208",
"react": "17.0.2",
"react-dom": "17.0.2"
},
"devDependencies": {
"shadow-cljs": "^2.15.10"
}
}
shadow-cljs.edn
{:nrepl {:port 8777}
:source-paths ["src" "test"]
:dependencies
[[reagent "1.1.0"]
[re-frame "1.2.0"]
[day8.re-frame/tracing "0.6.2"]
[binaryage/devtools "1.0.3"]
[day8.re-frame/re-frame-10x "1.2.0"]]
:dev-http
{8280 "resources/public"
8290 "target/browser-test"}
:builds
{:app
{:target :browser
:output-dir "resources/public/js/compiled"
:asset-path "/js/compiled"
:modules
{:app {:init-fn demo.core/init}}
:devtools
{:preloads [day8.re-frame-10x.preload]}
:dev
{:compiler-options
{:closure-defines
{ re-frame.trace.trace-enabled? true
day8.re-frame.tracing.trace-enabled? true}}}
:release
{:build-options
{:ns-aliases
{day8.re-frame.tracing day8.re-frame.tracing-stubs}}}}}}
I don't know what any of this does so I can't tell exactly but I'd start looking at the theme related code
Thanks thheller, Actually I am able to use that UI library in create-react-app
so I don't think any problem in JS component side.
Hi thheller, thanks for your help and time. We identified the problem is in local linking library and nothing with codes.