Closed sharadsw closed 3 weeks ago
Fixes #4865
When adding a form table subview, 2 resources were being created.
First one in FormTable.tsx: https://github.com/specify/specify7/blob/907d1524cfbc56380fc038b0f7a3663e7ff46576/specifyweb/frontend/js_src/lib/components/FormCells/FormTable.tsx#L458-L459
FormTable.tsx
Which gets set as an expanded record and gets passed up the parent chain: https://github.com/specify/specify7/blob/907d1524cfbc56380fc038b0f7a3663e7ff46576/specifyweb/frontend/js_src/lib/components/FormCells/FormTable.tsx#L125-L132
But that resource instance gets lost in RecordSelector.tsx, which creates a new resource that does not get added to expandedRecords and gets passed all the way up to SubView.tsx https://github.com/specify/specify7/blob/907d1524cfbc56380fc038b0f7a3663e7ff46576/specifyweb/frontend/js_src/lib/components/FormSliders/RecordSelector.tsx#L128-L134
RecordSelector.tsx
SubView.tsx
My change ensures RecordSelector uses the resource initialized by a child component.
For to-one relations:
For interactions:
Fixes #4865
When adding a form table subview, 2 resources were being created.
First one in
FormTable.tsx
: https://github.com/specify/specify7/blob/907d1524cfbc56380fc038b0f7a3663e7ff46576/specifyweb/frontend/js_src/lib/components/FormCells/FormTable.tsx#L458-L459Which gets set as an expanded record and gets passed up the parent chain: https://github.com/specify/specify7/blob/907d1524cfbc56380fc038b0f7a3663e7ff46576/specifyweb/frontend/js_src/lib/components/FormCells/FormTable.tsx#L125-L132
But that resource instance gets lost in
RecordSelector.tsx
, which creates a new resource that does not get added to expandedRecords and gets passed all the way up toSubView.tsx
https://github.com/specify/specify7/blob/907d1524cfbc56380fc038b0f7a3663e7ff46576/specifyweb/frontend/js_src/lib/components/FormSliders/RecordSelector.tsx#L128-L134My change ensures RecordSelector uses the resource initialized by a child component.
Checklist
Testing instructions
For to-one relations:
For interactions: