-
Notifications
You must be signed in to change notification settings - Fork 109
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
Late attachment of Downgraded plugin does not clean up the caches #101
Comments
What you do should work. |
Yes. The solution I've come up (kinda hacky) is to convert my object to a string when setting, and parsing as JSON after getting... so the whole thing is just a string and behaves with the rules of primitives. |
What is the result of Can you post the screenshot of object inspection for both variables? Can you create a separate repository with a reproducer? What you see is abnormal. Something strange with your environment. |
Here is a code sandbox with the issue recreated. I wasn't able to recreate what I'm seeing in my app in the sandbox. I realized I was running v2.0.1... upgraded to v3.0.1. This didn't solve the issues, but it prevent them from causing breaking errors. Here are screenshots from my app: Using the state in a component: As you can see, the attach() and get() methods are no longer throwing errors, but they are still returning the proxy instead of the actual object. |
The sample in codesandbox works fine. And I tested get methods and attached downgraded also makes an effect there. The only weird thing about the codesandbox is that it can not show proxies in the log console properly. It shows null instead. But I guess it is because the browser does not let javascript to inspect objects behind the proxy (which is expected and correct). If you see different behaviour in you app, could you please commit it to the repository which I could clone and install? |
The code is ensconced in our app and would be difficult to extricate and push to a repo... so, apologies, i can't provide the code for you to review. But thank you for your prompt replies and help with the issue. |
This worked! thanks! |
Keep it open. I will try to fix it so the order does not change the behaviour |
@avkonst |
The solution I think is known. Just did not have time to come back to it. I
will have a look at this tomorrow
…On Tue, 16 Feb 2021, 12:27 TroyJoachim, ***@***.***> wrote:
@avkonst <https://github.com/avkonst>
Were you about to find a possible fix of this. I would like to keep the
proxy type on there so I get the performance benefits, then remove it right
before I post to my api.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#101 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA6JSVPDDJZ3L65GJ2OII2TS7GUXNANCNFSM4RN3QSVA>
.
|
Fix released in 3.0.6 |
Hello It might be something simple ... but i can't access my nested state I created a state with hookstate({ When my app starts it sets When I try to access my globalState.value1 it returns a proxy instead of value same with .get() What am I doing wrong ? |
Ok, so I used .get({ noproxy: true }) and it works fine now i have array of objects. |
I am trying to do something very simple and what I consider intuitive... I am trying to create a global state which is an array of objects, and then tap into it later, getting and setting that global state. Problem is I'm not able to get() the value of this state, let alone set() it.
I have this:
Now I understand that this isn't necessarily the right way to access the state of an object... even following the docs, the example given doesn't work:
Really simple question... how can I 'get' the state value of an array of objects? Can I not just get it... do I have to map it first? Why isn't it as simple as just doing .get() like for primitives?
I also tried the fix mentioned in this thread...
The text was updated successfully, but these errors were encountered: