feat: update loading state handling in DutyList component
- Replaced the loading skeleton with a compact loading placeholder to improve user experience when data is not yet loaded for the month. - Enhanced the rendering logic to ensure the loading state is visually distinct and does not display the skeleton when data is being fetched. - Updated related tests to verify the new loading behavior and ensure accurate feedback during data fetching.
This commit is contained in:
@@ -42,12 +42,13 @@ describe("DutyList", () => {
|
||||
expect(screen.getByText(/No duties this month/i)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("renders quiet placeholder when data not yet loaded for month", () => {
|
||||
it("renders compact loading placeholder when data not yet loaded for month (no skeleton)", () => {
|
||||
useAppStore.getState().setDuties([]);
|
||||
useAppStore.getState().batchUpdate({ dataForMonthKey: null });
|
||||
render(<DutyList />);
|
||||
expect(screen.queryByText(/No duties this month/i)).not.toBeInTheDocument();
|
||||
expect(document.querySelector('[aria-busy="true"]')).toBeInTheDocument();
|
||||
expect(document.querySelector('[data-slot="skeleton"]')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("renders duty with full_name and time range", () => {
|
||||
|
||||
Reference in New Issue
Block a user