Skip to content

Conversation

@lichunn
Copy link
Collaborator

@lichunn lichunn commented Jan 21, 2026

English | 简体中文

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • Built its own designer, fully self-validated

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

Background and solution

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Chores
    • Adjusted login feature availability to dynamically enable based on environment and authentication configuration settings.

✏️ Tip: You can customize this high-level summary in your review settings.

@github-actions github-actions bot added the bug Something isn't working label Jan 21, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 21, 2026

Walkthrough

Introduces two environment-derived constants (isDevelopEnv and useAuth) to control a new enableLogin configuration property. The login feature gate is enabled when authentication is configured or the environment is not development.

Changes

Cohort / File(s) Summary
Feature Gate Configuration
packages/design-core/src/preview/src/previewDefaultRegistry.js
Added environment-derived constants and new enableLogin config property with conditional logic (useAuth || !isDevelopEnv) to gate login feature based on environment and auth settings

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A gate for login, so wise and so neat,
Dev mode and auth flags make logic complete!
With constants so bright and conditions so clear,
Feature control hops forward—no cause for fear! 🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: adding a configuration to allow preview without login based on development environment and auth settings.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@packages/design-core/src/preview/src/previewDefaultRegistry.js`:
- Around line 14-15: The enableLogin flag is currently computed using
isDevelopEnv and useAuth which causes enableLogin to be true in production when
VITE_AUTH is not set; update the logic to gate authentication solely on the
useAuth boolean (remove the fallback !isDevelopEnv), i.e., change the
enableLogin assignment that references isDevelopEnv and useAuth to only depend
on useAuth so that authentication is opt-in; apply the same change to the
enableLogin field in the registry export/function that uses the isDevelopEnv and
useAuth variables (look for the enableLogin property near where isDevelopEnv and
useAuth are defined).
🧹 Nitpick comments (1)
packages/design-core/src/preview/src/previewDefaultRegistry.js (1)

14-15: Consider centralizing env flag derivation to avoid drift.

isDevelopEnv/useAuth are already defined in packages/design-core/registry.js (Lines 59‑60). A shared helper (e.g., a small env.ts) would reduce divergence risk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant