Skip to content

feat: Widgetise app layout skeleton #3396

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 38 commits into
base: main
Choose a base branch
from

Conversation

georgylobko
Copy link
Member

@georgylobko georgylobko commented Apr 1, 2025

Description

quip k8bRAbqrduR3

Related links, issue #, if available: n/a

How has this been tested?

Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link

codecov bot commented Apr 22, 2025

Codecov Report

Attention: Patch coverage is 98.61878% with 5 lines in your changes missing coverage. Please review.

Project coverage is 96.50%. Comparing base (3ee9556) to head (19ddb8b).

Files with missing lines Patch % Lines
src/app-layout/visual-refresh-toolbar/internal.tsx 85.00% 2 Missing and 1 partial ⚠️
...p-layout/visual-refresh-toolbar/use-app-layout.tsx 98.57% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main    #3396    +/-   ##
========================================
  Coverage   96.49%   96.50%            
========================================
  Files         806      814     +8     
  Lines       23092    23272   +180     
  Branches     7987     8022    +35     
========================================
+ Hits        22283    22459   +176     
+ Misses        802      758    -44     
- Partials        7       55    +48     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

}));

describeEachAppLayout({ themes: ['refresh-toolbar'] }, () => {
describeEachAppLayout({ themes: ['refresh-toolbar'], skipInitialTest: true }, () => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to skip the mocks applied correctly test in this case because we set widgetMockEnabled = false to test the behavior of skeleton widgets. Since styles now come from widgets and the test relies on those classes, the test will always fail. That’s why we need this extra condition.

const rootRefInternal = useRef<HTMLDivElement>(null);
// This workaround ensures the ref is defined before checking if the app layout is nested.
// On initial render, the ref might be undefined because this component loads asynchronously via the widget API.
const onMountRootRef = useCallback(node => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is newly added. The rest of the code is unchanged and copied from the original index file

@georgylobko georgylobko marked this pull request as ready for review April 25, 2025 16:23
@georgylobko georgylobko requested a review from a team as a code owner April 25, 2025 16:23
@georgylobko georgylobko requested review from johannes-weber and just-boris and removed request for a team April 25, 2025 16:23
@georgylobko georgylobko marked this pull request as draft April 28, 2025 07:46
@@ -36,11 +35,11 @@ test('should render refresh-toolbar app layout with the widget flag', () => {
globalWithFlags[Symbol.for('awsui-visual-refresh-flag')] = () => true;
globalWithFlags[Symbol.for('awsui-global-flags')] = { appLayoutWidget: true };
const content = renderToStaticMarkup(<AppLayout />);
expect(content).toContain(refreshToolbarStyles.root);
expect(content).toBe('<div></div>');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition has changed because the styles now come from widget API, so they don't work with SSR

@georgylobko georgylobko marked this pull request as ready for review April 28, 2025 10:01
@georgylobko georgylobko marked this pull request as draft April 29, 2025 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant