Skip to content

Commit

Permalink
Merge pull request #36888 from phillip-kruger/devui-router-fix
Browse files Browse the repository at this point in the history
Fix dev-ui double contruction of Web Components
  • Loading branch information
phillip-kruger authored Nov 6, 2023
2 parents 5f70339 + 12839b7 commit 3602de6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,10 @@ export class RouterController {
}
} else {
// We know and already loaded the requested location
if (currentSelection === path) {
Router.go({pathname: path, search});
// The default naked route
} else if (!RouterController.router.location.route && defaultRoute && currentSelection.endsWith('/dev-ui/')) {
if (!RouterController.router.location.route && defaultRoute && currentSelection.endsWith('/dev-ui/')) {
Router.go({pathname: path, search});
// We do not know and have not yet loaded the requested location
} else if (!RouterController.router.location.route && defaultRoute) {

// pass original query param
const currentQueryString = window.location.search;
const origSearch = currentQueryString?.length > 0 ? '&' + currentQueryString : '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,20 @@ public void handle(RoutingContext event) {

try {
URL url = mvnpmLoader.getResource(BASE_DIR + fullPath);
URLConnection openConnection = url.openConnection();
long lastModified = openConnection.getLastModified();
try (InputStream is = openConnection.getInputStream()) {
if (is != null) {
byte[] contents = is.readAllBytes();
event.response()
.putHeader(HttpHeaders.CONTENT_TYPE, getContentType(fileName))
.putHeader(HttpHeaders.CACHE_CONTROL, "public, immutable, max-age=31536000")
.putHeader(HttpHeaders.LAST_MODIFIED, formatDate(lastModified))
.putHeader("date", formatDate(LocalDateTime.now()))
.end(Buffer.buffer(contents));
return;
if (url != null) {
URLConnection openConnection = url.openConnection();
long lastModified = openConnection.getLastModified();
try (InputStream is = openConnection.getInputStream()) {
if (is != null) {
byte[] contents = is.readAllBytes();
event.response()
.putHeader(HttpHeaders.CONTENT_TYPE, getContentType(fileName))
.putHeader(HttpHeaders.CACHE_CONTROL, "public, immutable, max-age=31536000")
.putHeader(HttpHeaders.LAST_MODIFIED, formatDate(lastModified))
.putHeader("date", formatDate(LocalDateTime.now()))
.end(Buffer.buffer(contents));
return;
}
}
}
} catch (IOException ex) {
Expand Down

0 comments on commit 3602de6

Please sign in to comment.