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

having problem with getting rid of proxy #403

Open
piotr-kozlowski-reps opened this issue Oct 16, 2023 · 2 comments
Open

having problem with getting rid of proxy #403

piotr-kozlowski-reps opened this issue Oct 16, 2023 · 2 comments
Labels
feedback Positive customer's feedback which does not fall into other categories

Comments

@piotr-kozlowski-reps
Copy link

I have problem with getting into plain data object via state.get() method.

Here's a small getter to have value out of hookstate:

    getCyclicalActivityFormikDataForPUT() {
      return state.get({ noproxy: true, stealth: true })
        .cyclicalActivityFormikDataForPUT;
    },

I also tried:

    getCyclicalActivityFormikDataForPUT() {
      return state.cyclicalActivityFormikDataForPUT.get({
        noproxy: true,
        stealth: true,
      });
    }

but my output is still:
ImmutableObject<ImmutableObject<.....someType>>
and should be just:
<.....someType>

What am I doing wrong? help please.
I just need plain data object to copy into Formik as initial state.

@avkonst
Copy link
Owner

avkonst commented Oct 16, 2023

You are doing all right. You get the object but it's type is readonly, which is correct. You are not allowed to change this object. There is a discussion around if ImmutableObject is useful. As of today just to cast to as yourtype.

@avkonst avkonst added the feedback Positive customer's feedback which does not fall into other categories label Oct 16, 2023
@piotr-kozlowski-reps
Copy link
Author

ok, I messed up Proxiness and Immutability :)
Simple casting did the trick, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feedback Positive customer's feedback which does not fall into other categories
Projects
None yet
Development

No branches or pull requests

2 participants