35
Root
7y

I finally got Redux-Form’s `initialValues` to work! Wooooo~!

/giphy confetti cheering

It turns out I haven’t actually been doing anything wrong for the past week. I mean, I've been working on other things during that week, too, but I've been trying to solve this the entire time.

The cause? ReduxForm made a breaking change awhile ago (v5; we’re using v7) that prevents the `initialValues` prop from working if you decorate your form component in the wrong order. Many examples online are incorrect because of this.

Basically, the decorators `reduxForm` and `connect` do not commute:

Incorrect:
`reduxForm(...)( connect(..., {...})(form) )`

vs Correct:
`connect(..., {...})( reduxForm(...)(form) )`

But what really pisses me off is that the fucking documentation specifically fucking states that you may decorate your component IN ANY [FUCKING] ORDER.

/giphy that is [fucking] false

So, I've been following example after [fucking] example that either list these in the wrong order, or I just don't notice the different order because it doesn't matter. AND because of that NONE OF THE [...] EXAMPLES WORK.

ARGH.

I've been pacing around the office trying to figure this out for days. I've rewritten my code three times to try to solve this. I've written two workarounds for it only to rip them out and try again because they both broke some other part of the UX. (e.g. causing false validation errors after rerender)

just. hafhsldkjhgjkhagklwhsdjfkahslf. 😡

/giphy angry hades

You know how I discovered this?
I found it in a github ticket. One solitary, untagged ticket from October of last year. Not a single goddamn post anywhere else mentioned this. And the [...] documentation specifically [...] states the [...] opposite!

Bloody [...] hell.

but it finally works.
as;kgjhaekl;gahgjkdflssdafh.

I could scream.

Comments
  • 1
    That's rough. I feel ya
  • 2
    Ahh, even though I am just reading this, I feel so angry at the at the devs. FFS GET YOUR **** RIGHT
  • 1
    You may just have saved several hours of my week
  • 3
    Fuck, that's so shitty. Coming from python, I take good documentation for granted. I can't even think how I could've learned programming without proper documentation.

    So, thumbs up for you. You solved it with sherlock holmes levels of wit.
  • 0
    I'm fully understand your rage about worse docu. I saw this myself too often.

    But as you know better by now are you helping to correct and improve the docu? At least opening an issue in the project? 😉 With a Link to this rant? ^^
  • 2
    @ebroda I might after I calm down.

    I still want to bite their head(s) off.
Add Comment