Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use theme in makeStyles in Fable 3 #59

Closed
ameier38 opened this issue Nov 15, 2020 · 12 comments · Fixed by #64
Closed

Cannot use theme in makeStyles in Fable 3 #59

ameier38 opened this issue Nov 15, 2020 · 12 comments · Fixed by #64

Comments

@ameier38
Copy link

First, thanks for this library. Really makes my life much easier.

I am trying out Fable 3 but I can't seem to use the theme argument of Styles.makeStyles.

let useStyles = Styles.makeStyles(fun styles theme ->
    {|
        root = styles.create [
            style.backgroundColor theme.palette.primary.dark // causes 'arg.Feliz.MaterialUI.Theme.get_palette is not a function'
        ]
    |}
)

I am having trouble figuring out how where the get_pallete is coming from. I feel like it should just be pallet.
image

Here is a reproduceable example: https://github.com/ameier38/feliz-material-ui-fable-3

@cmeeren
Copy link
Collaborator

cmeeren commented Nov 15, 2020

Hi, thanks for the report! Unfortunately I have limited resources to spend on maintaining Feliz.MaterialUI at the moment, so I'm unsure when I'll be able to have a look at it. Please let me know if you are able to figure out what's wrong or how to fix it in the meantime.

@ameier38
Copy link
Author

No problem! I'll keep digging and create a PR if I find a fix.

@cmeeren
Copy link
Collaborator

cmeeren commented Nov 15, 2020

Thanks! If there's a problem in generated code, you don't have to learn my custom generator to create a PR, just let me know what's wrong and it's probably an easy fix for me.

@atheck
Copy link

atheck commented Dec 17, 2020

Hi, I have a similar issue with theme.spacing, theme.mixins and theme.zIndex.

Log output:

Uncaught TypeError: arg.Feliz.MaterialUI.Theme.get_mixins is not a function
at
Object.entries(arg["Feliz.MaterialUI.Theme.get_mixins"]()

@cmeeren
Copy link
Collaborator

cmeeren commented Dec 17, 2020

Thanks. Unfortunately I still have my hands too full to investigate an issue with no immediately discernible root cause. Particularly if this was something that changed between Fable 2 and Fable 3. Please let me know should you manage to figure out what needs fixing.

@alfonsogarciacaro
Copy link
Contributor

Sorry, I didn't know about this issue. Seems to be caused by how Fable 2 and 3 deal with abstract classes. I will send a PR to this repo to make sure the code works well both with Fable 2 and 3.

@alfonsogarciacaro
Copy link
Contributor

@cmeeren What's the best way to check everything is working? Building the docs?

@cmeeren
Copy link
Collaborator

cmeeren commented Dec 21, 2020

@cmeeren What's the best way to check everything is working? Building the docs?

Building the CiBuild target should check everything, including generating the package. But Docs:Build is almost as good.

@cmeeren
Copy link
Collaborator

cmeeren commented Dec 21, 2020

v1.2.4 will appear on NuGet shortly with this fix.

@alfonsogarciacaro
Copy link
Contributor

Awesome, thanks a lot @cmeeren! There was another issue in Fable affecting Feliz.MaterialUI so users may need to update Fable too to 3.0.5: dotnet tool update fable

@halcwb
Copy link

halcwb commented Dec 22, 2020

I can confirm that everything work!! @cmeeren @alfonsogarciacaro Great work, thanks.

@cmeeren
Copy link
Collaborator

cmeeren commented Dec 22, 2020

Awesome, thanks a lot @cmeeren!

I simply released your fix, this one is on you 👏🥳 Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants