ReferenceInput doesn't inject filter prop to child
See original GitHub issue // In packages/ra-ui-materialui/src/input/ReferenceInput.spec.tsx
it('should pass filter prop to child', () => {
let gblFilter = {};
const Component = props => {
gblFilter = props.filter;
return <div data-testid="test">Hello</div>;
};
render(
<ReferenceInputView
{...defaultProps}
filter={{test: true}}
>
<Component/>
</ReferenceInputView>
);
expect(gblFilter).toEqual({test: true});
});
Environment
- React-admin version: 3.10.0
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
How to add a filter input based on another filter input on react ...
You might be able to solve this using a FormDataConsumer inside your Filter. <Filter {...props}> <ReferenceInput source="organizationId" .
Read more >The ReferenceInput Component - React-admin - Marmelab
You can tweak how this component fetches the possible values using the page , perPage , sort , and filter props. // by...
Read more >Filter Component - ag-Grid (React)
Filter components allow you to add your own filter types to ag-Grid. ... Instead use the React props passed to your Component. destroy()...
Read more >React Admin Modal: Create Record Without Leaving Page
You should see a list of Posts with options to Add Filter, Create, ... React-Admin uses the Material UI library, so we don...
Read more >https://raw.githubusercontent.com/marmelab/admin-o...
Changelog ## v1.4.1 * Add `addLabel` default prop in custom Field documentation ... Fix filter in `<ReferenceInput>` not taken into account when ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Closing as we only changed an internal API - the public API remains unchanged.
I’ve use
ReferenceInputView
in the test by copying from another one of your tests. And I assume you did this because is simpler for the tested features but not for what I wanted to test sincefilter
prop is injected fromuseReferenceInputController
to theReferenceInputView
. You might be right about this one.