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

Uncaught TypeError: Cannot read property session of undefined #744

Open
vdhand-xactly opened this issue Jun 18, 2021 · 3 comments
Open

Uncaught TypeError: Cannot read property session of undefined #744

vdhand-xactly opened this issue Jun 18, 2021 · 3 comments

Comments

@vdhand-xactly
Copy link

I am using redux-orm for a react project. But, I can't figure out this error:

useSelector.js:38 Uncaught TypeError: Cannot read property 'session' of undefined
    at memoize.js:189
    at index.jsx:68
    at useSelectorWithStoreAndSubscription (useSelector.js:29)
    at useSelector2 (useSelector.js:106)
    at App (index.jsx:68)
    at renderWithHooks (react-dom.development.js:14985)
    at mountIndeterminateComponent (react-dom.development.js:17811)
    at beginWork (react-dom.development.js:19049)
    at HTMLUnknownElement.callCallback2 (react-dom.development.js:3945)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:3994)

index.jsx:68
const formDefinitions = useSelector(state => fullFormDefinitionSelector(state)); // ! This is causing an error

formDefinitionSelectors.js

// Selector to return fully populated datasources.
export const fullFormDefinitionSelector = createSelector(
    orm,
    session => {
        return session.FormDefinition.all()
            .toModelArray()
            .map(fd => {
                return {
                    ...fd.ref,
                    schema: fd.schema.toRefArray(),
                };
            });
    },

From, some debugging, I got to know that this issue is coming inside the memoize function. Apparently, the memize function is being called two times on initial render. The first time it is called, it has 3 arguments. But, when it is called for the second time, I just has one argument. So, the form argument is undefined inside the memoize function. This gives me the error: 'session' of undefined.
image

@Isaacmeedinaa
Copy link

Hello, any fix?

@vdhand-xactly
Copy link
Author

Unfortunately, this library is not maintained anymore 😞

@Isaacmeedinaa
Copy link

@vdhand-xactly Are you sure, how can we verify this? It makes sense because it's very buggy specially with Typescript. Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants