hookstate icon indicating copy to clipboard operation
hookstate copied to clipboard

What is Error 110?

Open winrid opened this issue 2 years ago • 4 comments

As funny as this is, what is error 110?

 ERROR  [Error: Error: HOOKSTATE-110 [path: /icons]. See https://hookstate.js.org/docs/exceptions#hookstate-110]

Error 110 is not listed: https://hookstate.js.org/docs/exceptions#hookstate-110

winrid avatar Aug 20 '22 00:08 winrid

Ah I see:

  • https://github.com/avkonst/hookstate/blob/c777715e3676f141555ecdfc15b3bfa199a01a10/core/src/index.ts#L1067
  • https://github.com/avkonst/hookstate/blob/c9f9f7571465a8cf2497257d446ac71857d5b638/core/src/tests/Object.tsx#L465

So it happens when you try to get a function without first converting the object back from a normal state object, or something?

winrid avatar Aug 20 '22 00:08 winrid

I have a similar problem.

Error: Error: HOOKSTATE-110 [path: /]. See https://hookstate.js.org/docs/exceptions#hookstate-110 at new StateInvalidUsageError (/home/xereda/desenvolvimento/repositorios/rch-frt-portal/node_modules/@hookstate/core/dist/index.js:488:23) at StateMethodsImpl.child (/home/xereda/desenvolvimento/repositorios/rch-frt-portal/node_modules/@hookstate/core/dist/index.js:1179:19) at Object.get (/home/xereda/desenvolvimento/repositorios/rch-frt-portal/node_modules/@hookstate/core/dist/index.js:1242:26) at CancelOrderModal (webpack-internal:///./src/components/CancelOrderModal/CancelOrderModal.js:36:44) at renderWithHooks (/home/xereda/desenvolvimento/repositorios/rch-frt-portal/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5658:16) at renderIndeterminateComponent (/home/xereda/desenvolvimento/repositorios/rch-frt-portal/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5731:15) at renderElement (/home/xereda/desenvolvimento/repositorios/rch-frt-portal/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5946:7) at renderNodeDestructiveImpl (/home/xereda/desenvolvimento/repositorios/rch-frt-portal/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6104:11) at renderNodeDestructive (/home/xereda/desenvolvimento/repositorios/rch-frt-portal/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6076:14) at renderNode (/home/xereda/desenvolvimento/repositorios/rch-frt-portal/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6259:12)

xereda avatar Sep 09 '22 17:09 xereda

@xereda If I remember correctly this happens if you have a state structure that contains a function.

winrid avatar Sep 09 '22 17:09 winrid

@winrid I did downgrade to version 3 then it's working again

xereda avatar Sep 09 '22 18:09 xereda

Correct. It is a new error from hookstate 4. Happens when you set to a state an object which has functions and after you attempt to get/call a function on state instead of obtaining the original value first. To do it right, you need to do instead: state.get({noproxy:true}).myfunction()

On Sat, Aug 20, 2022 at 12:46 PM Devon @.***> wrote:

Ah I see:

https://github.com/avkonst/hookstate/blob/c777715e3676f141555ecdfc15b3bfa199a01a10/core/src/index.ts#L1067

https://github.com/avkonst/hookstate/blob/c9f9f7571465a8cf2497257d446ac71857d5b638/core/src/tests/Object.tsx#L465

So it happens when you try to get a function without first converting the object back from a normal state object, or something?

— Reply to this email directly, view it on GitHub https://github.com/avkonst/hookstate/issues/324#issuecomment-1221191463, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6JSVODN64K7KJZJ53T5ZTV2ATHZANCNFSM57CKT2YA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

avkonst avatar Oct 11 '22 09:10 avkonst

@avkonst Hi Andrey, thank you for your message.

I'm not having a function property state.

xereda avatar Oct 11 '22 11:10 xereda

hmm... @xereda could you please help me to resolve this problem? I think it might be a bug in Hookstate-4 which detects the case 110 incorrectly. Could you please let me know what your state object is and what functions you call to get this exception raised?

avkonst avatar Oct 12 '22 20:10 avkonst

@avkonst You can debug where the exception happens like this: find Store.prototype.get in node_modules/@hookstate/core/dist/index.js change to:

Store.prototype.get = function (path) {
        var result = this._value;
        if (result === none) {
            return result;
        }
        path.forEach(function (p) {
            if (result === undefined) {
                console.log('???', path, p, new Error().stack);
            }
            result = result[p];
        });
        return result;
    };

You will then get a stack trace and the path that is causing the failure.

winrid avatar Oct 21 '22 22:10 winrid

@winrid thanks for the message. I know how to debug these problems. I do not know how to reproduce this problem. Could you please post a code sample which reproduces the problem?

avkonst avatar Oct 24 '22 05:10 avkonst

@avkonst

I've upgraded to the newest version of hookstate and now I need to pass a callback (function) through a state property. How to do it correctly?

xereda avatar Dec 14 '22 11:12 xereda

let state = useHookstate({ callback: () => { return 1; } });
state.get({ noproxy: true }).callback()

avkonst avatar Dec 17 '22 22:12 avkonst