Giter VIP home page Giter VIP logo

Comments (6)

MangelMaxime avatar MangelMaxime commented on August 25, 2024 1

The object you are passing is too big for stringifying it.

Same thing will probably occured if you do JSON.stringify yourClickEv

You should pass only the data you need.

When, you use a form input you pass:

OnInput (fun ev -> MyMsg ev.Value)

not:

OnInput (fun ev -> MyMsg ev)

from debugger.

alfonsogarciacaro avatar alfonsogarciacaro commented on August 25, 2024 1

@MangelMaxime Oh, I didn't know about that 😮 😅

@nojaf It's difficult to detect this kind of errors, I myself have been bitten by them several times. I think the main problem is we (by "we" I mean "I") started to use dynamic operators when dealing with React events (OnClick (fun ev -> ev.target?value |> doSomething)) which makes it easy to just write ev?value (or box in your case) and the compiler won't complain. We need to get used to write (ev.target :?> Browser.HTMLInputElement).value or use extensions like the one Maxime pointed out.

from debugger.

alfonsogarciacaro avatar alfonsogarciacaro commented on August 25, 2024

I have helpers like these in my project, maybe we could add them to Fable.React to prevent these situations:

let inline onValueChanged f =
    OnChange (fun ev -> (ev.target :?> Browser.HTMLInputElement).value |> f)

let inline onChecked f =
    OnChange (fun ev -> (ev.target :?> Browser.HTMLInputElement).``checked`` |> f)

from debugger.

et1975 avatar et1975 commented on August 25, 2024

This might actually work w/o a debugger and tracing, but as @MangelMaxime said, for showing the debug info we serialize the messages and in case of the full event object it will drag the entire browser DOM along. Closing.

from debugger.

MangelMaxime avatar MangelMaxime commented on August 25, 2024

@alfonsogarciacaro Hum for the first one we already added ev.Value for this specific case.

https://github.com/fable-compiler/fable-react/blob/master/src/Fable.React/Fable.Helpers.React.fs#L1096-L1100

from debugger.

nojaf avatar nojaf commented on August 25, 2024

Could we not improve the error message? If you don't know this, it's hard to figure out...

from debugger.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.