Skip to content

Commit

Permalink
Add useFormStatus to server rendering stub (#26788)
Browse files Browse the repository at this point in the history
This was an oversight when I set up the hook in #26719.
  • Loading branch information
acdlite authored May 7, 2023
1 parent efb381b commit 16d053d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/react-dom/server-rendering-stub.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ export {
preconnect,
preload,
preinit,
experimental_useFormStatus,
} from './src/server/ReactDOMServerRenderingStub';
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,16 @@ describe('react-dom-server-rendering-stub', () => {
);
expect(x).toBe(false);
});

// @gate enableFormActions
// @gate enableAsyncActions
it('exports experimental_useFormStatus', async () => {
function App() {
const {pending} = ReactDOM.experimental_useFormStatus();
return 'Pending: ' + pending;
}

const result = await ReactDOMFizzServer.renderToStaticMarkup(<App />);
expect(result).toEqual('Pending: false');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

export {preinit, preload, preconnect, prefetchDNS} from '../ReactDOMFloat';
export {useFormStatus as experimental_useFormStatus} from 'react-dom-bindings/src/shared/ReactDOMFormActions';

export function createPortal() {
throw new Error(
Expand Down

0 comments on commit 16d053d

Please sign in to comment.