Skip to content

feat: add fallback prop to AuthenticatedContent for unauthenticated state#229

Open
svidgen wants to merge 3 commits into
mainfrom
feat/authenticated-content-fallback
Open

feat: add fallback prop to AuthenticatedContent for unauthenticated state#229
svidgen wants to merge 3 commits into
mainfrom
feat/authenticated-content-fallback

Conversation

@svidgen

@svidgen svidgen commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds an optional fallback parameter (third argument) to AuthenticatedContent. When the user is not authenticated, the component now renders the fallback node instead of an empty container.

Before

// Unauthenticated users see nothing — no way to show alternative UI
AuthenticatedContent(authApi, (user) => renderDashboard(user));

After

const loginPrompt = document.createElement('p');
loginPrompt.textContent = 'Please sign in to continue.';

AuthenticatedContent(authApi, (user) => renderDashboard(user), loginPrompt);
// Authenticated → dashboard
// Not authenticated → login prompt

Details

  • Optional third fallback?: Node parameter — fully backward-compatible.
  • No fallback provided → existing behavior (empty container when signed out).
  • Updated JSDoc, README, and tests (5 test cases covering all states).
  • Patch changeset for @aws-blocks/auth-common.

Testing

  • npm run build passes for the package.
  • All 53 unit tests pass (npm test -w packages/auth-common).

@svidgen
svidgen requested a review from a team as a code owner July 17, 2026 19:52
@changeset-bot

changeset-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b8b2fe7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@aws-blocks/auth-common Patch
@aws-blocks/blocks Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@svidgen
svidgen deployed to publish July 21, 2026 20:57 — with GitHub Actions Active
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