Skip to content

Commit

Permalink
fix: Do not try to refresh app while it is initializing (#20504) (#20512
Browse files Browse the repository at this point in the history
)

When the app is bootstrapping, it only contains
`initializing`, `isActive` and `productionMode`. We should not call `sendEventMessage` at this point or might cause `Uncaught TypeError: l.sendEventMessage is not a function`. 

This is unlikely to happen in many real world scenarios but happens in Copilot tests

Co-authored-by: Artur <[email protected]>
  • Loading branch information
vaadin-bot and Artur- authored Nov 19, 2024
1 parent da9b46d commit 73586c9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions vaadin-dev-server/src/main/frontend/vaadin-dev-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -656,9 +656,13 @@ export class VaadinDevTools extends LitElement {
.filter((key) => key !== 'TypeScript')
.map((id) => anyVaadin.Flow.clients[id])
.forEach((client) => {
client.sendEventMessage(1, "ui-refresh", {
fullRefresh: strategy === 'full-refresh'
})
if (client.sendEventMessage) {
client.sendEventMessage(1, "ui-refresh", {
fullRefresh: strategy === 'full-refresh'
})
} else {
console.warn("Ignoring ui-refresh event for application ",id);
}
});
} else {
const lastReload = window.sessionStorage.getItem(VaadinDevTools.TRIGGERED_COUNT_KEY_IN_SESSION_STORAGE);
Expand Down

0 comments on commit 73586c9

Please sign in to comment.