perf(RouteSchemaComponent): prevent unnecessary re-renders

This commit is contained in:
Zeke Zhang 2024-11-03 19:37:52 +08:00
parent 15a68eef66
commit c838ac70ad

View File

@ -8,10 +8,9 @@
*/
import React from 'react';
import { useParams } from 'react-router-dom';
import { RemoteSchemaComponent } from '../../../';
import { RemoteSchemaComponent, useCurrentPageUid } from '../../../';
export function RouteSchemaComponent() {
const params = useParams();
return <RemoteSchemaComponent onlyRenderProperties uid={params.name} />;
const currentPageUid = useCurrentPageUid();
return <RemoteSchemaComponent onlyRenderProperties uid={currentPageUid} />;
}