-
Notifications
You must be signed in to change notification settings - Fork 197
feat: hostname is now optional with a default, not required. #2570
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
Conversation
Console (appwrite/console)Project ID: Tip You can use Avatars API to generate QR code for any text or URLs. |
WalkthroughThe PR modifies a single Svelte component for creating a web platform. Hostname input is trimmed and a derived Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
🔇 Additional comments (2)
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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/routes/(console)/project-[region]-[project]/overview/platforms/createWeb.svelte (1)
165-169: Validation logic inconsistent with required attribute.The
requiredattribute makes hostname mandatory in the UI, but the validation logic at line 165 treats empty hostname as valid by settinghostnameError = null. This creates an inconsistency where:
- HTML5 validation requires the field (line 267)
- Custom validation allows empty values (line 165)
- The API call handles empty as optional (line 178)
If the HTML5 validation is bypassed, empty hostnames would pass validation and submit.
Consider either:
- Make hostname truly required: Update validation to always validate presence and format
- Keep hostname optional: Remove the
requiredattributeApply this diff if hostname should be truly required:
- hostnameError = hostname !== '' ? !new RegExp(extendedHostnameRegex).test(hostname) : null; + hostnameError = !hostname || !new RegExp(extendedHostnameRegex).test(hostname);And update line 178:
- hostname: hostname === '' ? undefined : hostname + hostname: hostnameAlso applies to: 267-267
🧹 Nitpick comments (2)
src/routes/(console)/project-[region]-[project]/overview/platforms/createWeb.svelte (2)
278-290: Consider icon semantics for hostname suggestions.The
IconPlusmay be semantically unclear—clicking a tag selects/applies the value rather than adding something new. Consider whether a checkmark or selection indicator would better communicate the action.
178-178: Empty string handling may be unnecessary with required field.Since hostname is now required (line 267), this empty string check is likely unreachable during normal flow. However, if you keep hostname as optional (per my previous comment about validation inconsistency), this defensive check remains useful.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/routes/(console)/project-[region]-[project]/overview/platforms/createWeb.svelte(5 hunks)
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2025-09-30T07:41:06.679Z
Learnt from: ItzNotABug
Repo: appwrite/console PR: 2425
File: src/routes/(console)/project-[region]-[project]/databases/database-[database]/(suggestions)/empty.svelte:454-468
Timestamp: 2025-09-30T07:41:06.679Z
Learning: In `src/routes/(console)/project-[region]-[project]/databases/database-[database]/(suggestions)/empty.svelte`, the column suggestions API (console.suggestColumns) has a maximum limit of 7 columns returned, which aligns with the initial placeholder count of 7 in customColumns.
Applied to files:
src/routes/(console)/project-[region]-[project]/overview/platforms/createWeb.svelte
📚 Learning: 2025-09-08T13:20:47.308Z
Learnt from: ItzNotABug
Repo: appwrite/console PR: 2316
File: src/routes/(console)/project-[region]-[project]/functions/create-function/deploy/+page.svelte:29-29
Timestamp: 2025-09-08T13:20:47.308Z
Learning: The Form.svelte component in the Appwrite console creates a FormContext with isSubmitting as writable(false) and expects consumers to work with Svelte writable stores, not plain booleans.
Applied to files:
src/routes/(console)/project-[region]-[project]/overview/platforms/createWeb.svelte
📚 Learning: 2025-09-26T06:48:57.938Z
Learnt from: ItzNotABug
Repo: appwrite/console PR: 2373
File: src/routes/(console)/project-[region]-[project]/databases/database-[database]/(suggestions)/empty.svelte:629-631
Timestamp: 2025-09-26T06:48:57.938Z
Learning: In the Appwrite console codebase using appwrite.io/pink-svelte, the Icon component automatically handles CSS variable names passed to its color prop by internally wrapping them with var(). Therefore, passing '--some-css-variable' as a string to the Icon color prop works correctly without needing to manually wrap it with var().
Applied to files:
src/routes/(console)/project-[region]-[project]/overview/platforms/createWeb.svelte
📚 Learning: 2025-10-13T05:13:54.542Z
Learnt from: ItzNotABug
Repo: appwrite/console PR: 2413
File: src/routes/(console)/project-[region]-[project]/databases/table.svelte:33-39
Timestamp: 2025-10-13T05:13:54.542Z
Learning: In Svelte 5, `import { page } from '$app/state'` provides a reactive state proxy that can be accessed directly (e.g., `page.params`), unlike the older `import { page } from '$app/stores'` which returns a readable store requiring the `$page` syntax for auto-subscription in components.
Applied to files:
src/routes/(console)/project-[region]-[project]/overview/platforms/createWeb.svelte
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: e2e
- GitHub Check: build
🔇 Additional comments (2)
src/routes/(console)/project-[region]-[project]/overview/platforms/createWeb.svelte (2)
14-15: LGTM! Imports are correctly added.The new imports (
Tag,IconJs,IconPlus) are properly utilized in the component.Also applies to: 28-29
73-73: LGTM! Reasonable hostname suggestions for local development.The suggested hostnames cover common localhost scenarios.
There was a problem hiding this 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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/routes/(console)/project-[region]-[project]/overview/platforms/createWeb.svelte(3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: e2e
- GitHub Check: build
🔇 Additional comments (1)
src/routes/(console)/project-[region]-[project]/overview/platforms/createWeb.svelte (1)
176-176: LGTM: API call correctly uses the validated hostname.The platform creation payload now uses
finalHostname, ensuring the API receives the validated, defaulted value rather than the raw (potentially empty) input. This change is consistent with the validation logic.
src/routes/(console)/project-[region]-[project]/overview/platforms/createWeb.svelte
Outdated
Show resolved
Hide resolved
| const trimmedHostname = hostname?.trim() || ''; | ||
| const finalHostname = trimmedHostname !== '' ? trimmedHostname : 'localhost'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could simplify.
| hostnameError = hostname !== '' ? !new RegExp(extendedHostnameRegex).test(hostname) : null; | ||
| const trimmedHostname = hostname?.trim() || ''; | ||
| const finalHostname = trimmedHostname !== '' ? trimmedHostname : 'localhost'; | ||
| hostnameError = !new RegExp(extendedHostnameRegex).test(finalHostname); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think we can do direct test check here on extendedHostnameRegex.
What does this PR do?
Related PRs and Issues
(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)
Have you read the Contributing Guidelines on issues?
(Write your answer here.)
Summary by CodeRabbit
New Features
Bug Fixes