Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    markCompostional
    @markCompostional
    I've managed to add a Zorder to the default style, and it now does something a bit more sensible, thanks
    Gregor Beyerle
    @WalternativE
    Does anyone else experience this bug from time to time? FSC : error FS0193: Das Modul bzw. der Namespace "Encode" aus der Kompilierungseinheit "Thoth.Json" enthielt nicht den Wert "ValLinkagePartialKey(generateEncoder)".
    Translated to English it would roughly mean The module or namespace "Encode" from the assembly "Thoth.Json" didn't contain the value "ValLinkagePartialKey(generateEncoder)".
    I assume this is a FSC problem as everything works fine and dandy when I use the fable compiler - dotnet build fails, though
    Cody Johnson
    @Shmew
    I've had it a few times, it means there is a version mismatch in your dependencies. @WalternativE It specifically happens in my experience when a library allows a dependency that it doesn't support.
    Gregor Beyerle
    @WalternativE
    Thanks! I've been trying to identify the culprit for a couple of hours now and it is slowly driving me crazy 🙃
    Cody Johnson
    @Shmew
    Yeah when I first had the issue I spent a lot of hours trying to figure it out too lol. cmeeren/Feliz.MaterialUI#23 that's the issue I had logged for when I had the problem.
    Gregor Beyerle
    @WalternativE
    Thanks for the hint - I'd just love to know when this happend. I basically changed nothing and it started to happen after I added a new project containing no external dependencies
    I assume that something has been broken before and just surfaced when I changed the project status
    Cody Johnson
    @Shmew
    Yeah, in my case it was using a particular function that would make it happen. @MangelMaxime might be able to help more. Although we probably need your paket.dependencies to really troubleshoot any further
    Gregor Beyerle
    @WalternativE
    I think I got it!
    Just let me verify that it was in fact the problem and not just pure chance again.
    Ok, the error is gone but I don't have the slightest clue why
    Gregor Beyerle
    @WalternativE
    I assumed that the Elmish Debugger package was the culprit because it depends on Thoth.Json >= 3.0 and I pin Thoth.Json to 3.4.1 because of the newest Thot.Fetch beta
    So I deleted the reference to the debugger and it worked again - then I reintroduced the dependency and it still worked.
    I tried to delete bin and obj folders, performed a paket install --force - still nothing, works even with Elmish Debugger
    Cody Johnson
    @Shmew
    I know some of the packages I use pin thoth.json to 3.3 let me see which one does that
    Gregor Beyerle
    @WalternativE
    Yeah, but that should be visible in the paket.lock file, right?
    Cody Johnson
    @Shmew
    oh nvm that's just me forgetting a ~>
    beats me then
    Gregor Beyerle
    @WalternativE
    Yeah, me too
    At this point "Compiler Gremlins" appears to be the most logical conclusion 🙃
    Cody Johnson
    @Shmew
    but no the problem is that they dont show up in the paket.lock because one of the libraries you're using isn't compatible with Thoth.Json at the version you're using it at, but they have it allowed.
    you could try moving down a minor version like to 3.3 and see if that fixes it
    Gregor Beyerle
    @WalternativE
    The "problem" is - it is already fixed
    The stuff works
    It shouldn't because basically nothing changed but there are no more errors and everything is fine
    I honestly don't know how this can be - everything I know about the system tells me that this must be impossible
    Cody Johnson
    @Shmew
    ¯\(ツ)
    Gregor Beyerle
    @WalternativE
    Yep - Gremlins
    Cody Johnson
    @Shmew
    moral of the story is don't feed your compiler after midnight
    Gregor Beyerle
    @WalternativE
    Ok, it weren't the Gremlins - coding after dark is still ok ^^
    It was in fact the Elmish Debugger - I just didn't open the namespace (I maybe should take a break after finishing this) so it had no reason to fail as it was never compiled
    Cody Johnson
    @Shmew
    do you know why it was giving you the issue? does it not support the latest thoth.json?
    Gregor Beyerle
    @WalternativE
    Seems to be that way. By the virtue of its lock file (Thoth.Json >= 3.0) one would assume that Thoth.Json 3.4.1 would be ok - apparently that's wrong
    Cody Johnson
    @Shmew
    could you log an issue for debugger to let them know they need to pin the version or update?
    Gregor Beyerle
    @WalternativE
    Yeah, just setting up a minimal repro first
    Cody Johnson
    @Shmew
    :+1:
    Gregor Beyerle
    @WalternativE
    Finally came around to create the issue. Hope this helps elmish/debugger#38
    semuserable
    @semuserable

    Hi everyone!

    Can someone help me with understanding how Hooks work in FableElmishReact world?

    Task:
    I want to bind a model value to a text change event from textararea

    // functional component
    type NlpTextInputProps = { Value: string }
    
    let NlpTextInput = FunctionComponent.Of(fun (props: NlpTextInputProps) ->
            let state = Hooks.useState(props.Value)
            let onChange (e: Event) =
                let newValue: string = !!e.target?value
                state.update newValue
    
            textarea [
                DefaultValue state.current
                OnChange onChange 
            ] []
        )
    
    let inline nlpTextInput value = ofFunction NlpTextInput { Value = value } []
    
    // somewhere in the view
    let view (model:Model) dispatch =
         div [] [nlpTextInput model.CurrentText]
    
    // somewhere in the update
    let update (msg:Message) (prevState:Model) =
         // pattern matching and stuff
        JS.console.log prevState.CurrentText // <- THIS is NOT updating

    I don't want to create a separate message type. I just want to bind it directly to a model (like in Angular). I thought I could archive it with Hooks, but maybe I misunderstand something?

    Any help is much appreciated!

    Maxime Mangel
    @MangelMaxime
    Hooks are local to your component
    So only the state in your component will change, if you want to access the new state in the elmish update function you need to send it via a message
    semuserable
    @semuserable
    @MangelMaxime understood, thank you!
    Ákos Lukács
    @AkosLukacs

    But if you want to store some state you don't really care about, like the internal state of an Elmish.Datepicker, you can use a state hook. Something like

    let dpState = Hooks.useState { DatePicker.Types.defaultState with ShowDeleteButton = true }
    let onChange (state: DatePicker.Types.State, date) = dpState.update state; props.OnChange(date)
    let pickerConfig : DatePicker.Types.Config<'Msg> = datepickerDefaultConfig onChange
    
    DatePicker.View.root pickerConfig dpState.current props.Datum props.Dispatch

    and doesn't clutter you model.

    semuserable
    @semuserable
    Cool! Thanks.
    Cody Johnson
    @Shmew
    @MangelMaxime btw your version in the header of the Thoth.Elmish.Debouncer docs says it's on 0.3.0 rather than 1.0
    Eric Vincent
    @efvincent
    My apologies if this has been discussed before - but why was the dotnet new template approach to project creation removed in this latest version? It seems like a big step backwards to have to clone a sample repo and hack it up in order to create a new project.
    Florian Verdonck
    @nojaf
    @efvincent it is a maintenance problem I think.
    Maintaining a template requires more time than simply maintaining a repo.
    At a certain point I was maintaining my own template and well those things get out of sync quickly.
    https://github.com/nojaf/fable-template