Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions libs/windy-sounding/src/sounding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const { emitter: windyPicker } = W.picker;
const windyRootScope = W.rootScope;
const { singleclick } = W.singleclick;
const favs = W.userFavs;
const broadcast = W.broadcast;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code-quality): Prefer object destructuring when accessing and using properties. (use-object-destructuring)

Suggested change
const broadcast = W.broadcast;
const {broadcast} = W;


ExplanationObject destructuring can often remove an unnecessary temporary reference, as well as making your code more succinct.

From the Airbnb Javascript Style Guide


let appContainer: HTMLElement;
let resizeObserver: ResizeObserver | undefined;
Expand Down Expand Up @@ -103,11 +104,11 @@ export const mountPlugin = (container: HTMLElement) => {
addSubscription(() => windyPicker.off(pickerMovedEventId));
}

const favsChangedEventId = favs.on('favsChanged', () => {
const favChangedEventId = broadcast.on('favChanged', () => {
dispatch(pluginSlice.setFavorites(favs.getArray()));
});
Comment on lines +107 to 109
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Verify the event name change.

The event name has changed from 'favsChanged' to 'favChanged'. Please ensure this aligns with the Windy API's event naming convention.

Run this script to verify the event name in the Windy API:


🏁 Script executed:

#!/bin/bash
# Description: Search for other usages of 'favChanged' and 'favsChanged' events
# to confirm the correct event name

echo "Searching for 'favChanged' event usage:"
rg -A 2 "favChanged"

echo -e "\nSearching for 'favsChanged' event usage:"
rg -A 2 "favsChanged"

Length of output: 1055


Action Required: Ensure Consistent Event Naming Across the Codebase

The change to use the 'favChanged' event in libs/windy-sounding/src/sounding.tsx aligns with the updated naming convention as confirmed by its usage in libs/windy-sounding/types/client/d.ts.files/broadcast.d.ts. However, the older event name 'favsChanged' is still present in libs/windy-sounding/types/client/userFavs.d.ts. Please verify if the Windy API has fully embraced the new event name and update the legacy references accordingly to maintain consistency.

  • File Reference:
    • libs/windy-sounding/src/sounding.tsx – Uses 'favChanged'.
    • libs/windy-sounding/types/client/d.ts.files/broadcast.d.ts – Declares event as 'favChanged'.
    • libs/windy-sounding/types/client/userFavs.d.ts – Still declares event as 'favsChanged'.


addSubscription(() => favs.off(favsChangedEventId));
addSubscription(() => broadcast.off(favChangedEventId));
};

// Called when the plugin is opened
Expand Down
Loading