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
Is your feature request related to a problem? Please describe.
I thought it might be nice to have a fallback option for Can component instead of using passThrough that works similiar to react Suspense.
Describe the solution you'd like <Can I="save" a="Post" fallback={<h1>Not authorized</h1>} ><button>Save</button></Can>
Unfortunately I could not run the repo via contribution guidelines. ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL @casl/[email protected] prebuild: rm -rf dist/* && npm run build.types Exit status 2
So I am pasting the untested code here - I added some documentation to Can component. Maybe helpful:
it('renders fallback children if `fallback` prop is assigned',()=>{constcomponent=renderer.create(e(Can,{I: 'delete',a: 'Post',fallback: e('h1',null,'not authorized'), ability },child))expect(ability.can('delete','Post')).to.be.falseexpect(component.toJSON().children).to.deep.equal([child.props.children])})
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
I thought it might be nice to have a fallback option for Can component instead of using passThrough that works similiar to react Suspense.
Describe the solution you'd like
<Can I="save" a="Post" fallback={<h1>Not authorized</h1>} ><button>Save</button></Can>
Unfortunately I could not run the repo via contribution guidelines.
ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL @casl/[email protected] prebuild:
rm -rf dist/* && npm run build.typesExit status 2
So I am pasting the untested code here - I added some documentation to Can component. Maybe helpful:
Not sure if this test is enough for Can.spec.js:
The text was updated successfully, but these errors were encountered: