fix: prevent addon stylesheet links from being removed during CSS live reload#23892
fix: prevent addon stylesheet links from being removed during CSS live reload#23892
Conversation
…e reload During CSS live reload, `PublicResourcesLiveUpdater` pushed null content for addon stylesheets not found in local source roots, and `removeOldLinks()` in vaadin-dev-tools used substring matching (`.includes()`) which could incorrectly remove unrelated `<link>` tags. Server-side changes: - Add jar-resources folder as a watched source root in `DevModeHandlerManagerImpl` so addon CSS changes are detected - Skip pushing null updates for stylesheets that exist on the classpath (e.g. from addon JARs) in `PublicResourcesLiveUpdater` - Use `ResourceProvider` to check classpath existence before deciding to remove a stylesheet - Strip `frontend/` prefix in `PublicStyleSheetBundler` when resolving addon stylesheets against jar-resources roots, since `TaskCopyFrontendFiles` removes that prefix during copy Client-side change: - Replace `.includes(path)` with path-suffix matching in `removeOldLinks()` to only remove links whose href ends with `'/' + path` or exactly equals `path`, after stripping query strings and fragments Fixes #23880
|
Test Results 1 384 files 1 384 suites 1h 27m 11s ⏱️ Results for commit 315327f. ♻️ This comment has been updated with latest results. |
…e reload (#23892) During CSS live reload, `PublicResourcesLiveUpdater` pushed null content for addon stylesheets not found in local source roots, and `removeOldLinks()` in vaadin-dev-tools used substring matching (`.includes()`) which could incorrectly remove unrelated `<link>` tags. Server-side changes: - Add jar-resources folder as a watched source root in `DevModeHandlerManagerImpl` so addon CSS changes are detected - Skip pushing null updates for stylesheets that exist on the classpath (e.g. from addon JARs) in `PublicResourcesLiveUpdater` - Use `ResourceProvider` to check classpath existence before deciding to remove a stylesheet - Strip `frontend/` prefix in `PublicStyleSheetBundler` when resolving addon stylesheets against jar-resources roots, since `TaskCopyFrontendFiles` removes that prefix during copy Client-side change: - Replace `.includes(path)` with path-suffix matching in `removeOldLinks()` to only remove links whose href ends with `'/' + path` or exactly equals `path`, after stripping query strings and fragments Fixes #23880
|
Hi @mcollovati and @mshabarov, when i performed cherry-pick to this commit to 25.0, i have encountered the following issue. Can you take a look and pick it manually? |
…e reload (#23892) (#23960) During CSS live reload, `PublicResourcesLiveUpdater` pushed null content for addon stylesheets not found in local source roots, and `removeOldLinks()` in vaadin-dev-tools used substring matching (`.includes()`) which could incorrectly remove unrelated `<link>` tags. Server-side changes: - Add jar-resources folder as a watched source root in `DevModeHandlerManagerImpl` so addon CSS changes are detected - Skip pushing null updates for stylesheets that exist on the classpath (e.g. from addon JARs) in `PublicResourcesLiveUpdater` - Use `ResourceProvider` to check classpath existence before deciding to remove a stylesheet - Strip `frontend/` prefix in `PublicStyleSheetBundler` when resolving addon stylesheets against jar-resources roots, since `TaskCopyFrontendFiles` removes that prefix during copy Client-side change: - Replace `.includes(path)` with path-suffix matching in `removeOldLinks()` to only remove links whose href ends with `'/' + path` or exactly equals `path`, after stripping query strings and fragments Fixes #23880 Co-authored-by: Marco Collovati <marco@vaadin.com>
…e reload (#23892) During CSS live reload, `PublicResourcesLiveUpdater` pushed null content for addon stylesheets not found in local source roots, and `removeOldLinks()` in vaadin-dev-tools used substring matching (`.includes()`) which could incorrectly remove unrelated `<link>` tags. Server-side changes: - Add jar-resources folder as a watched source root in `DevModeHandlerManagerImpl` so addon CSS changes are detected - Skip pushing null updates for stylesheets that exist on the classpath (e.g. from addon JARs) in `PublicResourcesLiveUpdater` - Use `ResourceProvider` to check classpath existence before deciding to remove a stylesheet - Strip `frontend/` prefix in `PublicStyleSheetBundler` when resolving addon stylesheets against jar-resources roots, since `TaskCopyFrontendFiles` removes that prefix during copy Client-side change: - Replace `.includes(path)` with path-suffix matching in `removeOldLinks()` to only remove links whose href ends with `'/' + path` or exactly equals `path`, after stripping query strings and fragments Fixes #23880
…e reload (#23892) (CP: 25.0) (#23981) * fix: prevent addon stylesheet links from being removed during CSS live reload (#23892) During CSS live reload, `PublicResourcesLiveUpdater` pushed null content for addon stylesheets not found in local source roots, and `removeOldLinks()` in vaadin-dev-tools used substring matching (`.includes()`) which could incorrectly remove unrelated `<link>` tags. Server-side changes: - Add jar-resources folder as a watched source root in `DevModeHandlerManagerImpl` so addon CSS changes are detected - Skip pushing null updates for stylesheets that exist on the classpath (e.g. from addon JARs) in `PublicResourcesLiveUpdater` - Use `ResourceProvider` to check classpath existence before deciding to remove a stylesheet - Strip `frontend/` prefix in `PublicStyleSheetBundler` when resolving addon stylesheets against jar-resources roots, since `TaskCopyFrontendFiles` removes that prefix during copy Client-side change: - Replace `.includes(path)` with path-suffix matching in `removeOldLinks()` to only remove links whose href ends with `'/' + path` or exactly equals `path`, after stripping query strings and fragments Fixes #23880 * fix test



During CSS live reload,
PublicResourcesLiveUpdaterpushed null content for addon stylesheets not found in local source roots, andremoveOldLinks()in vaadin-dev-tools used substring matching (.includes()) which could incorrectly remove unrelated<link>tags.Server-side changes:
DevModeHandlerManagerImplso addon CSS changes are detectedPublicResourcesLiveUpdaterResourceProviderto check classpath existence before deciding to remove a stylesheetfrontend/prefix inPublicStyleSheetBundlerwhen resolving addon stylesheets against jar-resources roots, sinceTaskCopyFrontendFilesremoves that prefix during copyClient-side change:
.includes(path)with path-suffix matching inremoveOldLinks()to only remove links whose href ends with'/' + pathor exactly equalspath, after stripping query strings and fragmentsFixes #23880