mirror of
https://github.com/documenso/documenso.git
synced 2025-11-16 01:32:06 +10:00
fix: status widget rerendering (#1097)
--- name: Pull Request about: Submit changes to the project for review and inclusion --- ## Description Should fix the rerendering of the status widget ## Related Issue <!--- If this pull request is related to a specific issue, reference it here using #issue_number. --> <!--- For example, "Fixes #123" or "Addresses #456". --> ## Changes Made <!--- Provide a summary of the changes made in this pull request. --> <!--- Include any relevant technical details or architecture changes. --> - Change 1 - Change 2 - ... ## Testing Performed <!--- Describe the testing that you have performed to validate these changes. --> <!--- Include information about test cases, testing environments, and results. --> - Tested feature X in scenario Y. - Ran unit tests for component Z. - Tested on browsers A, B, and C. - ... ## Checklist <!--- Please check the boxes that apply to this pull request. --> <!--- You can add or remove items as needed. --> - [ ] I have tested these changes locally and they work as expected. - [ ] I have added/updated tests that prove the effectiveness of these changes. - [ ] I have updated the documentation to reflect these changes, if applicable. - [ ] I have followed the project's coding style guidelines. - [ ] I have addressed the code review feedback from the previous submission, if applicable. ## Additional Notes <!--- Provide any additional context or notes for the reviewers. --> <!--- This might include details about design decisions, potential concerns, or anything else relevant. -->
This commit is contained in:
@ -6,7 +6,7 @@ import { StatusWidget } from './status-widget';
|
|||||||
export function StatusWidgetContainer() {
|
export function StatusWidgetContainer() {
|
||||||
return (
|
return (
|
||||||
<Suspense fallback={<StatusWidgetFallback />}>
|
<Suspense fallback={<StatusWidgetFallback />}>
|
||||||
<StatusWidget />
|
<StatusWidget slug="documenso-status" />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import { use, useMemo } from 'react';
|
import { memo, use } from 'react';
|
||||||
|
|
||||||
import type { Status } from '@openstatus/react';
|
import { type Status, getStatus } from '@openstatus/react';
|
||||||
import { getStatus } from '@openstatus/react';
|
|
||||||
|
|
||||||
import { cn } from '@documenso/ui/lib/utils';
|
import { cn } from '@documenso/ui/lib/utils';
|
||||||
|
|
||||||
@ -45,9 +44,8 @@ const getStatusLevel = (level: Status) => {
|
|||||||
}[level];
|
}[level];
|
||||||
};
|
};
|
||||||
|
|
||||||
export function StatusWidget() {
|
export const StatusWidget = memo(function StatusWidget({ slug }: { slug: string }) {
|
||||||
const getStatusMemoized = useMemo(async () => getStatus('documenso-status'), []);
|
const { status } = use(getStatus(slug));
|
||||||
const { status } = use(getStatusMemoized);
|
|
||||||
const level = getStatusLevel(status);
|
const level = getStatusLevel(status);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -72,4 +70,4 @@ export function StatusWidget() {
|
|||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
}
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user