Skip to content

Commit

Permalink
fix(EmptyTab): allow ref to empty tab component
Browse files Browse the repository at this point in the history
  • Loading branch information
marstamm committed Oct 8, 2024
1 parent dd4eace commit 24e086a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
8 changes: 4 additions & 4 deletions client/src/app/TabsProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* except in compliance with the MIT License.
*/

import React from 'react';
import React, { forwardRef } from 'react';

import {
find,
Expand Down Expand Up @@ -138,9 +138,9 @@ export default class TabsProvider {
return false;
},
getComponent() {
return (props) => {
return <EmptyTab { ...props } tabsProvider={ self } />;
};
return forwardRef((props, ref) => {
return <EmptyTab ref={ ref } { ...props } tabsProvider={ self } />;
});
},
getIcon() {
return null;
Expand Down
2 changes: 1 addition & 1 deletion resources/plugins/test-tab/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const tab = {
return file.name.endsWith('.helloWorld');
},
getComponent(options) {
return () => <h1>Hello world!</h1>;
return React.forwardRef((_, ref) => <h1 ref={ ref }>Hello world!</h1>);
},
getIcon() {
return null;
Expand Down
4 changes: 3 additions & 1 deletion resources/plugins/test-tab/dist/client.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 24e086a

Please sign in to comment.