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

ReferenceArrayInput replace of undefined (basepath) #3883

Closed
gvillo opened this issue Oct 25, 2019 · 3 comments
Closed

ReferenceArrayInput replace of undefined (basepath) #3883

gvillo opened this issue Oct 25, 2019 · 3 comments
Assignees
Labels

Comments

@gvillo
Copy link
Contributor

gvillo commented Oct 25, 2019

What you were expecting:
ReferenceArrayInput is not working fine on v3 beta.3. It's failing on a line with a FIXME comment on ra-core/esm/controller/input/useReferenceArrayInputController.js file

var referenceBasePath = basePath.replace(resource, reference); // FIXME obviously very weak

What happened instead:
It's not rendering at all.

Steps to reproduce:
Just add a filter including a ReferenceArrayInput to a List and run it.

Related code:

  <Filter {...props}>
    <TextInput label="Search" source="q" alwaysOn />
    <ReferenceArrayInput label="Tags" source="tagsIds" reference="tags">
      <SelectArrayInput optionText="description" />
    </ReferenceArrayInput>
  </Filter>

Environment

  • React-admin version: v3.0.0-beta.3
  • Last version that did not exhibit the issue (if applicable):
  • React version: v16.10.2
  • Browser: Google Chrome 77.0.3865.120 (Official Build) (64-bit)
  • Stack trace (in case of a JS error):
Uncaught TypeError: Cannot read property 'replace' of undefined
    at useReferenceArrayInputController (useReferenceArrayInputController.js:136)
    at ReferenceArrayInput (ReferenceArrayInput.js:257)
    at renderWithHooks (react-dom.development.js:16367)
    at mountIndeterminateComponent (react-dom.development.js:18731)
    at beginWork$1 (react-dom.development.js:20061)
    at HTMLUnknownElement.callCallback (react-dom.development.js:363)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:412)
    at invokeGuardedCallback (react-dom.development.js:465)
    at beginWork$$1 (react-dom.development.js:25711)
    at performUnitOfWork (react-dom.development.js:24616)
    at workLoopSync (react-dom.development.js:24592)
    at performSyncWorkOnRoot (react-dom.development.js:24153)
    at react-dom.development.js:12313
    at unstable_runWithPriority (scheduler.development.js:818)
    at runWithPriority$2 (react-dom.development.js:12259)
    at flushSyncCallbackQueueImpl (react-dom.development.js:12308)
    at flushSyncCallbackQueue (react-dom.development.js:12296)
    at discreteUpdates$1 (react-dom.development.js:24334)
    at discreteUpdates (react-dom.development.js:1485)
    at dispatchDiscreteEvent (react-dom.development.js:5949)
useReferenceArrayInputController @ useReferenceArrayInputController.js:136
ReferenceArrayInput @ ReferenceArrayInput.js:257
renderWithHooks @ react-dom.development.js:16367
mountIndeterminateComponent @ react-dom.development.js:18731
beginWork$1 @ react-dom.development.js:20061
callCallback @ react-dom.development.js:363
invokeGuardedCallbackDev @ react-dom.development.js:412
invokeGuardedCallback @ react-dom.development.js:465
beginWork$$1 @ react-dom.development.js:25711
performUnitOfWork @ react-dom.development.js:24616
workLoopSync @ react-dom.development.js:24592
performSyncWorkOnRoot @ react-dom.development.js:24153
(anonymous) @ react-dom.development.js:12313
unstable_runWithPriority @ scheduler.development.js:818
runWithPriority$2 @ react-dom.development.js:12259
flushSyncCallbackQueueImpl @ react-dom.development.js:12308
flushSyncCallbackQueue @ react-dom.development.js:12296
discreteUpdates$1 @ react-dom.development.js:24334
discreteUpdates @ react-dom.development.js:1485
dispatchDiscreteEvent @ react-dom.development.js:5949
index.js:1375 The above error occurred in the <ReferenceArrayInput> component:
    in ReferenceArrayInput (created by Field)
    in Field (created by FilterFormInput)
    in div (created by FilterFormInput)
    in FilterFormInput (created by FilterForm)
    in form (created by FilterForm)
    in FilterForm (created by ReactFinalForm)
    in ReactFinalForm (created by EnhancedFilterForm)
    in EnhancedFilterForm (created by Filter)
    in Filter (at TemplatesList.js:18)
    in TemplatesFilter (at TemplatesList.js:29)
    in div (created by ForwardRef(Toolbar))
    in ForwardRef(Toolbar) (created by WithStyles(ForwardRef(Toolbar)))
    in WithStyles(ForwardRef(Toolbar)) (created by ListToolbar)
    in ListToolbar (created by ListView)
    in div (created by ListView)
    in ListView (created by List)
    in List (at TemplatesList.js:27)
    in TemplatesList (created by WithPermissions)
    in WithPermissions (created by Context.Consumer)
    in Route (created by ResourceRoutes)
    in Switch (created by ResourceRoutes)
    in ResourceRoutes (created by Resource)
    in Resource (at App.js:72)
    in Route (created by RoutesWithLayout)
    in Switch (created by RoutesWithLayout)
    in RoutesWithLayout (created by Context.Consumer)
    in div (created by Layout)
    in main (created by Layout)
    in div (created by Layout)
    in div (created by Layout)
    in Layout (created by WithStyles(Layout))
    in WithStyles(Layout) (created by Context.Consumer)
    in withRouter(WithStyles(Layout)) (created by ConnectFunction)
    in ConnectFunction (created by LayoutWithTheme)
    in ThemeProvider (created by LayoutWithTheme)
    in LayoutWithTheme (at Layout.js:12)
    in Unknown (created by Context.Consumer)
    in Route (created by CoreAdminRouter)
    in Switch (created by CoreAdminRouter)
    in div (created by CoreAdminRouter)
    in CoreAdminRouter (created by Context.Consumer)
    in Route (created by CoreAdmin)
    in Switch (created by CoreAdmin)
    in Router (created by ConnectedRouter)
    in ConnectedRouter (created by Context.Consumer)
    in ConnectedRouterWithContext (created by ConnectFunction)
    in ConnectFunction (created by CoreAdmin)
    in TranslationProvider (created by CoreAdmin)
    in Provider (created by CoreAdmin)
    in CoreAdmin (at App.js:41)
    in App (at src/index.js:8)
@djhi
Copy link
Collaborator

djhi commented Oct 26, 2019

Thanks for reporting this. If you are able to illustrate the bug or feature request with an example, please provide a sample application via one of the following means:

@fzaninotto
Copy link
Member

Confirmed and reproduced, thanks for the report.

@fzaninotto
Copy link
Member

Fixed by #3898

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

No branches or pull requests

3 participants