You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What you were expecting: ReferenceArrayField loads associated records.
What happened instead: ReferenceArrayField does initially load records, but gets caught in an infinite loop, calling setState.
Steps to reproduce:
Create Show view inside of a TabbedShowLayout (SimpleShowLayout also probably fine, but not tested) with a ReferenceArrayField containing an array of id's for associated records. When the view loads, it gets caught in infinite loop and will eventually lock up. This ONLY occurs when the collection is empty.
Related code:
Difficult to reproduce in sandbox, but can try to get something up if needed.
Last version that did not exhibit the issue (if applicable): v2.9.5
React version: 16.9.0
Browser: Chrome Version 76.0.3809.100
Stack trace (in case of a JS error):
Warning: Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render.
in ReferenceArrayField (at UserShow.js:57)
in div (created by Labeled)
in div (created by ForwardRef(FormControl))
in ForwardRef(FormControl) (created by WithStyles(ForwardRef(FormControl)))
in WithStyles(ForwardRef(FormControl)) (created by Labeled)
in Labeled (created by WithStyles(Labeled))
in WithStyles(Labeled) (created by Tab)
in div (created by Tab)
in span (created by Tab)
in Tab (created by Context.Consumer)
in translate(Tab) (at UserShow.js:44)
in Route (created by TabbedShowLayout)
in div (created by ForwardRef(CardContent))
in ForwardRef(CardContent) (created by WithStyles(ForwardRef(CardContent)))
in WithStyles(ForwardRef(CardContent)) (created by CardContentInner)
in CardContentInner (created by WithStyles(CardContentInner))
in WithStyles(CardContentInner) (created by TabbedShowLayout)
in div (created by TabbedShowLayout)
in TabbedShowLayout (created by Context.Consumer)
in translate(TabbedShowLayout) (created by Context.Consumer)
in withRouter(translate(TabbedShowLayout)) (at UserShow.js:43)
in div (created by ForwardRef(Paper))
in ForwardRef(Paper) (created by WithStyles(ForwardRef(Paper)))
in WithStyles(ForwardRef(Paper)) (created by ForwardRef(Card))
in ForwardRef(Card) (created by WithStyles(ForwardRef(Card)))
in WithStyles(ForwardRef(Card)) (created by ShowView)
in div (created by ShowView)
in div (created by ShowView)
in ShowView (created by Show)
in Show (at UserShow.js:37)
in UserShow (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:69)
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:17)
in Unknown (created by WithStyles(Component))
in WithStyles(Component) (created by Context.Consumer)
in Route (created by CoreAdminRouter)
in Switch (created by CoreAdminRouter)
in div (created by CoreAdminRouter)
in CoreAdminRouter (created by ConnectFunction)
in ConnectFunction
in ConnectFunction (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 TranslationProviderView (created by ConnectFunction)
in ConnectFunction (created by CoreAdmin)
in Provider (created by CoreAdmin)
in CoreAdmin (at App.js:39)
in App (at src/index.js:7)```
The text was updated successfully, but these errors were encountered:
b-raines
changed the title
ReferenceArrayField causing infinite loop w/ setState
ReferenceArrayField causing infinite loop when empty collection
Aug 20, 2019
What you were expecting:
ReferenceArrayField
loads associated records.What happened instead:
ReferenceArrayField
does initially load records, but gets caught in an infinite loop, callingsetState
.Steps to reproduce:
Create
Show
view inside of aTabbedShowLayout
(SimpleShowLayout
also probably fine, but not tested) with aReferenceArrayField
containing an array of id's for associated records. When the view loads, it gets caught in infinite loop and will eventually lock up. This ONLY occurs when the collection is empty.Related code:
Difficult to reproduce in sandbox, but can try to get something up if needed.
Environment
The text was updated successfully, but these errors were encountered: