Shmew/Feliz.MaterialUI

Cannot use theme in `makeStyles` in Fable 3

Closed this issue · 12 comments

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

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.

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

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.

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"]()

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.

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.

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

@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.

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

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

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

Awesome, thanks a lot @cmeeren!

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