tonyhb / tectonic

A declarative REST data loader for React and Redux. Docs @
https://tonyhb.github.io/tectonic/
456 stars 31 forks source link

query.hash() is not function #78

Closed andreyluiz closed 7 years ago

andreyluiz commented 7 years ago

Here I am again. :P

I'm getting this error while loading my page:

TypeError: query.hash is not a function
   at Cache.getQueryStatus (/home/andrey/Projects/Datarisk/app-frontend/node_modules/tectonic/transpiled/cache/index.js:409:49)
   at /home/andrey/Projects/Datarisk/app-frontend/node_modules/tectonic/transpiled/manager/index.js:165:28
   at Array.forEach (native)
   at Manager.props (/home/andrey/Projects/Datarisk/app-frontend/node_modules/tectonic/transpiled/manager/index.js:162:28)
   at PropInspector.computeDependencies (/home/andrey/Projects/Datarisk/app-frontend/node_modules/tectonic/transpiled/decorator/propInspector.js:80:37)
   at new TectonicComponent (/home/andrey/Projects/Datarisk/app-frontend/node_modules/tectonic/transpiled/decorator/index.js:102:43)
   at /home/andrey/Projects/Datarisk/app-frontend/node_modules/react-dom/lib/ReactCompositeComponent.js:295:18
   at measureLifeCyclePerf (/home/andrey/Projects/Datarisk/app-frontend/node_modules/react-dom/lib/ReactCompositeComponent.js:75:12)
   at ReactCompositeComponentWrapper._constructComponentWithoutOwner (/home/andrey/Projects/Datarisk/app-frontend/node_modules/react-dom/lib/ReactCompositeComponent.js:294:16)
   at ReactCompositeComponentWrapper._constructComponent (/home/andrey/Projects/Datarisk/app-frontend/node_modules/react-dom/lib/ReactCompositeComponent.js:280:21)
   at ReactCompositeComponentWrapper.mountComponent (/home/andrey/Projects/Datarisk/app-frontend/node_modules/react-dom/lib/ReactCompositeComponent.js:188:21)
   at Object.mountComponent (/home/andrey/Projects/Datarisk/app-frontend/node_modules/react-dom/lib/ReactReconciler.js:46:35)
   at ReactCompositeComponentWrapper.performInitialMount (/home/andrey/Projects/Datarisk/app-frontend/node_modules/react-dom/lib/ReactCompositeComponent.js:371:34)
   at ReactCompositeComponentWrapper.mountComponent (/home/andrey/Projects/Datarisk/app-frontend/node_modules/react-dom/lib/ReactCompositeComponent.js:258:21)
   at Object.mountComponent (/home/andrey/Projects/Datarisk/app-frontend/node_modules/react-dom/lib/ReactReconciler.js:46:35)
   at ReactCompositeComponentWrapper.performInitialMount (/home/andrey/Projects/Datarisk/app-frontend/node_modules/react-dom/lib/ReactCompositeComponent.js:371:34)

Did I miss something?

tonyhb commented 7 years ago

What are you passing in to the load decorator?

IE.

@load(...)

On Tue, Feb 14, 2017, 9:36 AM Andrey Luiz notifications@github.com wrote:

Here I am again. :P

I'm getting this error while loading my page:

TypeError: query.hash is not a function at Cache.getQueryStatus (/home/andrey/Projects/Datarisk/app-frontend/node_modules/tectonic/transpiled/cache/index.js:409:49) at /home/andrey/Projects/Datarisk/app-frontend/node_modules/tectonic/transpiled/manager/index.js:165:28 at Array.forEach (native) at Manager.props (/home/andrey/Projects/Datarisk/app-frontend/node_modules/tectonic/transpiled/manager/index.js:162:28) at PropInspector.computeDependencies (/home/andrey/Projects/Datarisk/app-frontend/node_modules/tectonic/transpiled/decorator/propInspector.js:80:37) at new TectonicComponent (/home/andrey/Projects/Datarisk/app-frontend/node_modules/tectonic/transpiled/decorator/index.js:102:43) at /home/andrey/Projects/Datarisk/app-frontend/node_modules/react-dom/lib/ReactCompositeComponent.js:295:18 at measureLifeCyclePerf (/home/andrey/Projects/Datarisk/app-frontend/node_modules/react-dom/lib/ReactCompositeComponent.js:75:12) at ReactCompositeComponentWrapper._constructComponentWithoutOwner (/home/andrey/Projects/Datarisk/app-frontend/node_modules/react-dom/lib/ReactCompositeComponent.js:294:16) at ReactCompositeComponentWrapper._constructComponent (/home/andrey/Projects/Datarisk/app-frontend/node_modules/react-dom/lib/ReactCompositeComponent.js:280:21) at ReactCompositeComponentWrapper.mountComponent (/home/andrey/Projects/Datarisk/app-frontend/node_modules/react-dom/lib/ReactCompositeComponent.js:188:21) at Object.mountComponent (/home/andrey/Projects/Datarisk/app-frontend/node_modules/react-dom/lib/ReactReconciler.js:46:35) at ReactCompositeComponentWrapper.performInitialMount (/home/andrey/Projects/Datarisk/app-frontend/node_modules/react-dom/lib/ReactCompositeComponent.js:371:34) at ReactCompositeComponentWrapper.mountComponent (/home/andrey/Projects/Datarisk/app-frontend/node_modules/react-dom/lib/ReactCompositeComponent.js:258:21) at Object.mountComponent (/home/andrey/Projects/Datarisk/app-frontend/node_modules/react-dom/lib/ReactReconciler.js:46:35) at ReactCompositeComponentWrapper.performInitialMount (/home/andrey/Projects/Datarisk/app-frontend/node_modules/react-dom/lib/ReactCompositeComponent.js:371:34)

Did I miss something?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tonyhb/tectonic/issues/78, or mute the thread https://github.com/notifications/unsubscribe-auth/AASsAbsTbWcor1AGDOdSy1xu-6ldx1Rsks5rceY3gaJpZM4MAxcy .

andreyluiz commented 7 years ago

Wow, I looked in your code and felt embarrassed.

Do I need to use it as a decorator?

export default load(() => ({
  users: User.list(),
}))(AdminUserListPage);
tonyhb commented 7 years ago

You'll wanna use something like this:

@load(() => ({ users: User.getList() }))

Notice it's getList - this tells load that you want to get a list. The list function is used when specifying sources :)

On Tue, Feb 14, 2017, 9:48 AM Andrey Luiz notifications@github.com wrote:

Wow, I looked in your code and felt embarrassed.

Do I need to use it as a decorator?

export default load(() => ({ users: User.list(), }))(AdminUserListPage);

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/tonyhb/tectonic/issues/78#issuecomment-279781505, or mute the thread https://github.com/notifications/unsubscribe-auth/AASsAW2ZNnyrtyrgr_3wVDOujn56DRWLks5rcejWgaJpZM4MAxcy .

andreyluiz commented 7 years ago

Ah, okay. I though I could use something like the connect function from redux. I was avoiding using decorators until now.

andreyluiz commented 7 years ago

I still have a problem:

Warning: Failed propType: Invalid prop state of type Object supplied to TectonicComponent, expected instance of Map. Apparently it's something related to immutable.

I'm really struggling to get this running, but I will investigate. :|

andreyluiz commented 7 years ago

Do you have any idea?

tonyhb commented 7 years ago

Got caught up in a few meetings and with some other issues for work. Gonna hop back on this very soon!

andreyluiz commented 7 years ago

Thank you. I'm still trying to find out what's wrong.

tonyhb commented 7 years ago

Any updates on this?

andreyluiz commented 7 years ago

I ended up doing it by hand. Thank you.