Skip to content

fix: Modify preview url - #1826

Open
xuanlid wants to merge 2 commits into
opentiny:developfrom
xuanlid:fix/preview-error
Open

fix: Modify preview url#1826
xuanlid wants to merge 2 commits into
opentiny:developfrom
xuanlid:fix/preview-error

Conversation

@xuanlid

@xuanlid xuanlid commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

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

  • Bug Fixes
    • Improved preview URL handling across production and alpha environments.
    • Added support for explicitly configured preview URLs.
    • Ensured preview links remain blank when no applicable URL is available.

@github-actions github-actions Bot added the bug Something isn't working label Jul 24, 2026
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Preview URL resolution was extracted into module-level constants in both designer registries. An explicit VITE_PREVIEW_URL now takes precedence, with production and alpha mode fallbacks retained before assigning the result to the Preview configuration.

Changes

Preview URL configuration

Layer / File(s) Summary
Resolve and wire preview URLs
designer-demo/registry.js, packages/engine-cli/template/designer/registry.js
Both registries prioritize VITE_PREVIEW_URL, otherwise derive /preview.html for production or alpha modes and use an empty value elsewhere. The Preview configuration references the computed constant.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested labels: bug

Poem

I’m a rabbit with a preview to show,
An explicit URL leads the flow.
In alpha or production, pages appear,
Other modes keep the path clear.
Hop, hop—configuration is neat!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change: updating preview URL behavior.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed: dependency version conflict. Check your lock file or package.json.


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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@designer-demo/registry.js`:
- Around line 21-22: Update the preview-mode gate in the registry configuration
to include `prod` alongside `production` and `alpha`, ensuring the
VITE_PREVIEW_URL fallback is enabled when running the documented production
build mode.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0963a1e3-ad4c-4059-9501-5ac6e305ade6

📥 Commits

Reviewing files that changed from the base of the PR and between 484898f and a8a87e3.

📒 Files selected for processing (2)
  • designer-demo/registry.js
  • packages/engine-cli/template/designer/registry.js

Comment thread designer-demo/registry.js
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