feat: derive CSS classname from demo route#146
Conversation
WalkthroughUpdates POM version to 5.3.0-SNAPSHOT, introduces legacy Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/main/java/com/flowingcode/vaadin/addons/demo/DynamicTheme.java (1)
138-149:⚠️ Potential issue | 🟡 MinorDocument the new
IllegalStateExceptionin this overload too.
initialize(IndexHtmlResponse)now callsassertNotLegacyTheme()(Line 152), so its Javadoc should include the same throws contract as theAppShellSettingsoverload.Javadoc consistency patch
/** * Initializes the theme settings into the provided {`@code` IndexHtmlResponse}. @@ * `@param` response the index HTML response to be modified * `@throws` UnsupportedOperationException if the runtime Vaadin version is older than 25 + * `@throws` IllegalStateException if the {`@link` AppShellConfigurator} is configured with the legacy + * {`@link` Theme} annotation */ public void initialize(IndexHtmlResponse response) {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/main/java/com/flowingcode/vaadin/addons/demo/DynamicTheme.java` around lines 138 - 149, The Javadoc for initialize(IndexHtmlResponse) is missing the new throws clause for IllegalStateException introduced by the call to assertNotLegacyTheme(); update the Javadoc on initialize(IndexHtmlResponse) to include an `@throws` IllegalStateException documenting that assertNotLegacyTheme() will throw when a legacy theme is detected (matching the AppShellSettings overload), in addition to the existing `@throws` UnsupportedOperationException note.
🧹 Nitpick comments (1)
src/main/java/com/flowingcode/vaadin/addons/demo/TabbedDemo.java (1)
203-212: Consider sanitizing route segments before using them as CSS class names, if special characters may appear in future routes.The current approach uses
@Routepath segments directly. While this works for the existing routes in the codebase (which contain only alphanumerics, slashes, and hyphens), hardening against special characters would be prudent defensive coding if dynamic or user-provided routes are ever introduced.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/main/java/com/flowingcode/vaadin/addons/demo/TabbedDemo.java` around lines 203 - 212, The route segments used to build CSS class names (in TabbedDemo where demo.getClass().getAnnotation(Route.class) is mapped and each segment appended to prefix and passed to demo.addClassName) should be sanitized first to remove or replace unsafe characters; before appending each segment, normalize it (e.g., toLowerCase()) and replace any characters not allowed in CSS class names (use a regex like [^a-z0-9_-] to replace with '-' or remove) and skip empty results so demo.addClassName only receives safe class-name tokens.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/main/java/com/flowingcode/vaadin/addons/demo/DynamicTheme.java`:
- Around line 138-149: The Javadoc for initialize(IndexHtmlResponse) is missing
the new throws clause for IllegalStateException introduced by the call to
assertNotLegacyTheme(); update the Javadoc on initialize(IndexHtmlResponse) to
include an `@throws` IllegalStateException documenting that assertNotLegacyTheme()
will throw when a legacy theme is detected (matching the AppShellSettings
overload), in addition to the existing `@throws` UnsupportedOperationException
note.
---
Nitpick comments:
In `@src/main/java/com/flowingcode/vaadin/addons/demo/TabbedDemo.java`:
- Around line 203-212: The route segments used to build CSS class names (in
TabbedDemo where demo.getClass().getAnnotation(Route.class) is mapped and each
segment appended to prefix and passed to demo.addClassName) should be sanitized
first to remove or replace unsafe characters; before appending each segment,
normalize it (e.g., toLowerCase()) and replace any characters not allowed in CSS
class names (use a regex like [^a-z0-9_-] to replace with '-' or remove) and
skip empty results so demo.addClassName only receives safe class-name tokens.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
pom.xmlsrc/main/java/com/flowingcode/vaadin/addons/demo/DynamicTheme.javasrc/main/java/com/flowingcode/vaadin/addons/demo/TabbedDemo.java



Summary by CodeRabbit
Release Notes
New Features
Bug Fixes