Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sounding release 4.0.0-beta.1 #267

Merged
merged 16 commits into from
Jul 13, 2024
Merged

Sounding release 4.0.0-beta.1 #267

merged 16 commits into from
Jul 13, 2024

Conversation

vicb
Copy link
Owner

@vicb vicb commented Jul 13, 2024

Summary by Sourcery

This pull request introduces significant refactoring and enhancements to the plugin's state management and component structure. It adds new features for handling plugin updates and displaying messages, improves existing components, and updates the documentation for the new release.

  • New Features:
    • Introduced a new Plugin component to manage the main plugin logic, including handling updates and displaying messages.
    • Added a new Message component to display various messages within the plugin interface.
    • Implemented a new updateTime thunk to handle time updates based on user interactions.
    • Added a new fetchPluginConfig thunk to fetch and compare plugin configurations for updates.
  • Enhancements:
    • Refactored the state management by splitting it into multiple slices: pluginSlice, forecastSlice, and unitsSlice.
    • Replaced the App component with the new Plugin component for better modularity.
    • Improved the SkewT and WindProfile components by removing the isLoading prop and simplifying their props.
    • Enhanced the Favorites component to use modern React practices and improved styling.
    • Updated the LoadingIndicator component to use dynamic width and height properties.
  • Documentation:
    • Updated the CHANGELOG.md to include the new release version 4.0.0-alpha.3 and its changes.
  • Chores:
    • Updated ESLint configuration to ignore additional files and directories.
    • Added new type definitions in env.d.ts for W.http and W.user.

Summary by CodeRabbit

  • New Features

    • Introduced a Message component for displaying styled messages.
    • Added unit management functionalities for temperature, altitude, wind speed, and pressure.
    • Added new Redux slices for managing forecast data and units.
  • Improvements

    • Enhanced performance and state management by refactoring components and splitting state slices.
    • Improved URL handling in the Plugin component.
  • Bug Fixes

    • Fixed class and style attribute usage in JSX components for better compatibility.
  • Dependency Updates

    • Updated various package versions for improved stability and performance.
  • Build and Deployment

    • Modified build commands and workflow to enhance the build process and deployment.

Copy link
Contributor

sourcery-ai bot commented Jul 13, 2024

Reviewer's Guide by Sourcery

This pull request implements significant refactoring and feature enhancements for the Windy Sounding plugin. The changes include splitting the state into multiple slices, adding a feature to check for updates, and refactoring various components to improve code readability and maintainability. The update also includes several bug fixes and performance improvements.

File-Level Changes

Files Changes
libs/windy-sounding/src/containers/containers.tsx
libs/windy-sounding/src/redux/plugin-slice.ts
libs/windy-sounding/src/redux/meta.ts
libs/windy-sounding/src/redux/forecast-slice.ts
libs/windy-sounding/src/redux/units-slice.ts
Refactored state management to use multiple slices and added new features for update management and time updates.
libs/windy-sounding/src/components/skewt.tsx
libs/windy-sounding/src/components/wind-profile.tsx
libs/windy-sounding/src/components/loading.tsx
libs/windy-sounding/src/components/message.tsx
Refactored components to improve readability and maintainability, and added new components for better user feedback.
libs/windy-sounding/src/sounding.tsx
libs/windy-sounding/src/Plugin.svelte
Updated plugin initialization and event handling logic.
libs/windy-sounding/src/styles.less
libs/windy-sounding/src/components/favorites.tsx
Updated styles and component attributes for better UI consistency and compatibility.

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link

coderabbitai bot commented Jul 13, 2024

Warning

Rate limit exceeded

@vicb has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 7 minutes and 14 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between 75d4634 and e6f8cf4.

Walkthrough

The recent update introduces numerous enhancements and fixes across various parts of the project, particularly focusing on the windy-sounding library. Key changes include dependency updates, new Redux slices for forecast and units management, improved plugin handling, and updated UI components. The build process for the windy-sounding component has also been streamlined, and new ESLint ignore patterns and .gitignore entries have been added.

Changes

File(s) Change Summary
libs/secrets/package.json Updated the @nx/webpack dependency version from 19.4.1 to 19.4.2.
libs/windy-sounding/.eslintrc.json, libs/windy-sounding/.gitignore Added new ignore patterns and gitignore rules.
libs/windy-sounding/CHANGELOG.md, libs/windy-sounding/package.json Updated version to 4.0.0-beta.1 and added new dependencies.
libs/windy-sounding/project.json Included --skip-nx-cache in build commands and added an upload task.
libs/windy-sounding/src/Plugin.svelte Enhanced URL parameter handling in the onopen function.
libs/windy-sounding/src/components/favorites.tsx, libs/windy-sounding/src/components/loading.tsx Refactored JSX attributes and updated function parameters.
libs/windy-sounding/src/components/message.tsx Introduced a new Message component for styled message boxes.
libs/windy-sounding/src/components/skewt.tsx, libs/windy-sounding/src/components/wind-profile.tsx Simplified props types and removed conditional loading checks.
libs/windy-sounding/src/containers/containers.tsx Refactored multiple components to use selectors and hooks for state management.
libs/windy-sounding/src/env.d.ts Added declarations for http and user properties.
libs/windy-sounding/src/redux/forecast-slice.ts, libs/windy-sounding/src/redux/units-slice.ts Introduced new Redux slices for managing forecast data and unit-related functionalities.
libs/windy-sounding/src/redux/meta.ts, libs/windy-sounding/src/redux/plugin-slice.ts, libs/windy-sounding/src/redux/store.ts Added new thunks, actions, and selectors; updated store configuration.
libs/windy-sounding/src/sounding.tsx Renamed components, updated dispatch logic, and added new functions.
libs/windy-sounding/src/styles.less Updated styles for various elements and pseudo-elements.
package.json Updated various @nx package versions and added new @types packages.
.github/workflows/upload-windy-sounding.yml Replaced npx nx prepare with npx nx build in the workflow file.

Poem

In the realm of code so tight,
Updates danced with sheer delight.
Windy-sounding took a leap,
New Redux slices for data to keep.
Components dressed in fresh attire,
With hooks and states, they now aspire.
A rabbit’s code, now crisp and bright,
To end the bugs, and set things right.
🎉❤️🐰


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @vicb - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 14 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟡 Documentation: 1 issue found

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

libs/windy-sounding/src/containers/containers.tsx Outdated Show resolved Hide resolved
libs/windy-sounding/src/components/loading.tsx Outdated Show resolved Hide resolved
libs/windy-sounding/src/redux/units-slice.ts Show resolved Hide resolved
libs/windy-sounding/CHANGELOG.md Show resolved Hide resolved
Copy link

Deploying flyxc with  Cloudflare Pages  Cloudflare Pages

Latest commit: c0a1a24
Status: ✅  Deploy successful!
Preview URL: https://14c2d202.flyxc.pages.dev
Branch Preview URL: https://windy-api.flyxc.pages.dev

View logs

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (1)
libs/windy-sounding/src/redux/plugin-slice.ts (1)

83-93: Question the necessity of new actions.

The new actions setStatus, setUpdateAvailable, setUpdateRequired, and setAvailableVersion are implemented correctly in libs/windy-sounding/src/redux/plugin-slice.ts but are not used elsewhere in the codebase. This raises questions about their necessity.

  • Ensure these actions are necessary and consider removing them if they are not used.
Analysis chain

Ensure correct implementation of new actions.

New actions setStatus, setUpdateAvailable, setUpdateRequired, and setAvailableVersion are added. Verify that these actions are necessary and correctly implemented.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation of new actions.

# Test: Search for the usage of `setStatus`, `setUpdateAvailable`, `setUpdateRequired`, and `setAvailableVersion`. Expect: Correct implementation found in the file.
rg --type ts 'setStatus|setUpdateAvailable|setUpdateRequired|setAvailableVersion' libs/windy-sounding/src/redux/plugin-slice.ts

Length of output: 776


Script:

#!/bin/bash
# Description: Verify the necessity of new actions by searching their usage in the entire codebase.

# Test: Search for the usage of `setStatus`, `setUpdateAvailable`, `setUpdateRequired`, and `setAvailableVersion` in the entire codebase.
rg --type ts 'setStatus|setUpdateAvailable|setUpdateRequired|setAvailableVersion'

Length of output: 1144

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 292a764 and c0a1a24.

Files ignored due to path filters (2)
  • libs/windy-sounding/package-lock.json is excluded by !**/package-lock.json
  • package-lock.json is excluded by !**/package-lock.json
Files selected for processing (21)
  • libs/secrets/package.json (1 hunks)
  • libs/windy-sounding/.eslintrc.json (1 hunks)
  • libs/windy-sounding/.gitignore (1 hunks)
  • libs/windy-sounding/CHANGELOG.md (1 hunks)
  • libs/windy-sounding/package.json (2 hunks)
  • libs/windy-sounding/src/Plugin.svelte (1 hunks)
  • libs/windy-sounding/src/components/favorites.tsx (3 hunks)
  • libs/windy-sounding/src/components/loading.tsx (1 hunks)
  • libs/windy-sounding/src/components/message.tsx (1 hunks)
  • libs/windy-sounding/src/components/skewt.tsx (9 hunks)
  • libs/windy-sounding/src/components/wind-profile.tsx (4 hunks)
  • libs/windy-sounding/src/containers/containers.tsx (4 hunks)
  • libs/windy-sounding/src/env.d.ts (1 hunks)
  • libs/windy-sounding/src/redux/forecast-slice.ts (1 hunks)
  • libs/windy-sounding/src/redux/meta.ts (4 hunks)
  • libs/windy-sounding/src/redux/plugin-slice.ts (5 hunks)
  • libs/windy-sounding/src/redux/store.ts (2 hunks)
  • libs/windy-sounding/src/redux/units-slice.ts (1 hunks)
  • libs/windy-sounding/src/sounding.tsx (5 hunks)
  • libs/windy-sounding/src/styles.less (4 hunks)
  • package.json (3 hunks)
Files skipped from review due to trivial changes (5)
  • libs/secrets/package.json
  • libs/windy-sounding/.eslintrc.json
  • libs/windy-sounding/.gitignore
  • libs/windy-sounding/src/components/message.tsx
  • package.json
Additional comments not posted (77)
libs/windy-sounding/src/components/loading.tsx (1)

1-6: LGTM! Ensure parameter usage is correct.

The changes to the parameters and their usage in the JSX look good. Ensure that the width and height parameters are always provided and valid.

libs/windy-sounding/package.json (2)

3-3: Version update is consistent.

The version number has been updated to 4.0.0-alpha.3, which is consistent with the changes made in the codebase.


21-21: New dependencies are correctly added.

The new dependencies semver and @types/semver have been correctly added to the dependencies and devDependencies sections.

Also applies to: 25-25

libs/windy-sounding/src/Plugin.svelte (1)

8-16: LGTM! Ensure legacy URL handling is correct.

The changes to handle legacy URL formats look good. Ensure that the parameters are always correctly updated and that the legacy formats are properly handled.

libs/windy-sounding/src/redux/store.ts (1)

4-6: New reducers are correctly included.

The new reducers for forecastSlice, pluginSlice, and unitsSlice have been correctly included and properly configured.

Also applies to: 24-25

libs/windy-sounding/src/env.d.ts (2)

25-25: LGTM! The http property is correctly added.

The http property is correctly imported from @windy/client/http.


26-26: LGTM! The user property is correctly added.

The user property is correctly imported from @windy/client/user.

libs/windy-sounding/src/redux/units-slice.ts (9)

1-4: LGTM! The imports are correctly added.

The imports include necessary functions from @reduxjs/toolkit and the RootState type from ./store.


5-6: LGTM! The constants are correctly added.

The constants windyStore and windyMetrics are correctly referencing W.store and W.metrics respectively.


8-18: LGTM! The types are correctly defined.

The types TempUnit, AltitudeUnit, SpeedUnit, PressureUnit, and UnitsState are correctly defined and used.


20-25: LGTM! The initial state is correctly defined.

The initial state for the units slice is correctly defined, referencing windyStore for default values.


27-31: LGTM! The slice is correctly defined.

The units slice is correctly created using createSlice, with an initial state and empty reducers.


33-36: LGTM! The selectors are correctly defined.

The selectors selTempUnit, selAltitudeUnit, selWindSpeedUnit, and selPressureUnit are correctly defined and used.


38-57: LGTM! The formatters are correctly defined.

The formatters selTempFormatter, selAltitudeFormatter, selPressureFormatter, and selWindSpeedFormatter are correctly defined using createSelector.


59-59: LGTM! The reducer is correctly defined.

The reducer for the units slice is correctly exported.


61-61: LGTM! The selectors are correctly defined.

The selectors for the units slice are correctly exported using slice.getSelectors.

libs/windy-sounding/CHANGELOG.md (1)

3-6: LGTM! The release notes for 4.0.0-alpha.3 are correctly added.

The release notes mention state splitting and update checks, providing necessary information for the release.

libs/windy-sounding/src/components/favorites.tsx (2)

68-78: LGTM! The JSX attributes are correctly updated.

The changes include updating class to className and style to use an object, which are necessary for React.


Line range hint 94-116:
LGTM! The conditional checks are correctly updated.

The changes include updating favorites.length == 0 to favorites.length === 0, which is a best practice for strict equality checks in JavaScript.

libs/windy-sounding/src/sounding.tsx (5)

54-60: Ensure proper cleanup of event listeners.

The added event listeners for swipe gestures should be properly cleaned up to avoid memory leaks. Verify that the controller.abort() is called appropriately.

Verification successful

Event listeners are properly cleaned up.

The controller.abort() is called within addSubscription(() => controller.abort());, ensuring proper cleanup of event listeners to avoid memory leaks.

  • libs/windy-sounding/src/sounding.tsx
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the proper cleanup of event listeners.

# Test: Search for the usage of `controller.abort()`. Expect: Cleanup found in the file.
rg --type tsx 'controller.abort' libs/windy-sounding/src/sounding.tsx

Length of output: 97


Script:

#!/bin/bash
# Description: Verify the proper cleanup of event listeners.

# Test: Search for the usage of `controller.abort()`. Expect: Cleanup found in the file.
rg 'controller.abort' libs/windy-sounding/src/sounding.tsx

Length of output: 109


8-8: Verify the necessity of new imports.

Ensure that the Plugin component and updateTime function are used in the file. If not, consider removing the unused imports to keep the code clean.

Also applies to: 15-16

Verification successful

The imports of Plugin and updateTime are necessary and used in the file.

  • Plugin is used in the JSX.
  • updateTime is used in a dispatch call.

No changes needed regarding these imports.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `Plugin` and `updateTime` in the file.

# Test: Search for the usage of `Plugin` and `updateTime`. Expect: Usage found in the file.
rg --type tsx 'Plugin|updateTime' libs/windy-sounding/src/sounding.tsx

Length of output: 100


Script:

#!/bin/bash
# Description: Verify the usage of `Plugin` and `updateTime` in the file.

# Test: Search for the usage of `Plugin` and `updateTime`. Expect: Usage found in the file.
rg 'Plugin|updateTime' libs/windy-sounding/src/sounding.tsx

Length of output: 554


Line range hint 139-145:
Ensure correct calculations for width and height.

The setSizeFrom function calculates the width and height based on the container size. Verify that the calculations are correct and necessary.

Verification successful

Verified: The calculations for width and height in the setSizeFrom function are correct and necessary.

The function appropriately adjusts the dimensions based on the container's size and the device type, ensuring a responsive design.

  • The width is calculated as container.clientWidth - padding, where padding is conditionally set based on the device type.
  • The height is set to the minimum of the calculated width and window.innerHeight * 0.7.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the calculations for width and height.

# Test: Search for the usage of `setSizeFrom`. Expect: Correct calculations implemented in the file.
rg --type tsx 'setSizeFrom' libs/windy-sounding/src/sounding.tsx

Length of output: 92


Script:

#!/bin/bash
# Description: Verify the calculations for width and height.

# Test: Search for the usage of `setSizeFrom`. Expect: Correct calculations implemented in the file.
rg --type ts 'setSizeFrom' libs/windy-sounding/src/sounding.tsx

Length of output: 174


Script:

#!/bin/bash
# Description: Retrieve context around the `setSizeFrom` calls and definition.

# Retrieve context around the calls to `setSizeFrom`.
rg --type ts 'setSizeFrom' -A 5 -B 5 libs/windy-sounding/src/sounding.tsx

# Retrieve the full function definition of `setSizeFrom`.
rg --type ts 'function setSizeFrom' -A 10 -B 2 libs/windy-sounding/src/sounding.tsx

Length of output: 1635


136-136: Ensure proper cleanup of subscriptions and markers.

The destroyPlugin function calls cancelAllSubscriptions and maybeRemoveMarker. Verify that these cleanup functions are necessary and correctly implemented.

Verification successful

Let's correct the previous script to search within TypeScript files without specifying a file type.


To ensure that cancelAllSubscriptions and maybeRemoveMarker are correctly implemented, we need to locate their definitions and examine their implementations.


Let's retrieve the implementations of cancelAllSubscriptions and maybeRemoveMarker from libs/windy-sounding/src/redux/meta.ts to verify their correctness.


Ensure proper cleanup of subscriptions and markers.

The destroyPlugin function calls cancelAllSubscriptions and maybeRemoveMarker. Both functions are correctly implemented and necessary for cleanup:

  • cancelAllSubscriptions clears all subscription callbacks and resets the list.

  • maybeRemoveMarker removes the marker from the map if it exists.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the proper cleanup of subscriptions and markers.

# Test: Search for the usage of `cancelAllSubscriptions` and `maybeRemoveMarker`. Expect: Cleanup functions correctly implemented in the file.
rg --type tsx 'cancelAllSubscriptions|maybeRemoveMarker' libs/windy-sounding/src/sounding.tsx

Length of output: 123


Script:

#!/bin/bash
# Description: Verify the proper cleanup of subscriptions and markers.

# Test: Search for the usage of `cancelAllSubscriptions` and `maybeRemoveMarker`. Expect: Cleanup functions correctly implemented in the file.
rg 'cancelAllSubscriptions|maybeRemoveMarker' libs/windy-sounding/src/sounding.tsx

Length of output: 182


Script:

#!/bin/bash
# Description: Locate the definitions of `cancelAllSubscriptions` and `maybeRemoveMarker` to verify their implementations.

# Search for the definition of `cancelAllSubscriptions`
rg 'function cancelAllSubscriptions' 

# Search for the definition of `maybeRemoveMarker`
rg 'function maybeRemoveMarker'

Length of output: 229


Script:

#!/bin/bash
# Description: Retrieve the implementations of `cancelAllSubscriptions` and `maybeRemoveMarker` to verify their correctness.

# Extract the implementation of `cancelAllSubscriptions`
rg -A 10 'export function cancelAllSubscriptions' libs/windy-sounding/src/redux/meta.ts

# Extract the implementation of `maybeRemoveMarker`
rg -A 10 'export function maybeRemoveMarker' libs/windy-sounding/src/redux/meta.ts

Length of output: 602


127-130: Ensure proper initialization of plugin state.

The openPlugin function dispatches actions to update the plugin state. Verify that the dispatched actions are necessary and correctly implemented.

libs/windy-sounding/src/redux/meta.ts (5)

1-1: Verify the necessity of new imports.

Ensure that the ThunkAction and UnknownAction types are used in the file. If not, consider removing the unused imports to keep the code clean.

Verification successful

Verified the necessity of new imports.

The ThunkAction and UnknownAction types are used in the file, confirming that the imports are necessary.

  • ThunkAction and UnknownAction are used in multiple lines within the file.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `ThunkAction` and `UnknownAction` in the file.

# Test: Search for the usage of `ThunkAction` and `UnknownAction`. Expect: Usage found in the file.
rg --type ts 'ThunkAction|UnknownAction' libs/windy-sounding/src/redux/meta.ts

Length of output: 381


61-71: Ensure correct implementation of changeLocation thunk.

The changeLocation thunk handles location updates and fetches forecasts. Verify that the implementation is correct and necessary.

Verification successful

The changeLocation thunk is correctly implemented and necessary.

The changeLocation thunk is used in multiple files across the codebase, indicating its importance. The implementation in libs/windy-sounding/src/redux/meta.ts correctly handles location updates and fetches forecasts.

  • libs/windy-sounding/src/sounding.tsx
  • libs/windy-sounding/src/containers/containers.tsx
  • libs/windy-sounding/src/redux/plugin-slice.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation of `changeLocation` thunk.

# Test: Search for the usage of `changeLocation`. Expect: Correct implementation found in the file.
rg --type ts 'changeLocation' libs/windy-sounding/src/redux/meta.ts

Length of output: 97


Script:

#!/bin/bash
# Description: Verify the usage and necessity of `changeLocation` thunk.

# Test: Search for the usage of `changeLocation` across the entire codebase.
rg --type ts 'changeLocation'

Length of output: 872


14-17: Ensure correct usage of TimeStep type.

The TimeStep type is declared for use in thunks. Verify that this type is necessary and correctly implemented.

Verification successful

Verified the correct usage of TimeStep type.

The TimeStep type is correctly implemented and used in the codebase, specifically within the containers.tsx file where it is used to structure an object passed to the updateTime function.

  • libs/windy-sounding/src/redux/meta.ts
  • libs/windy-sounding/src/containers/containers.tsx
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `TimeStep` type.

# Test: Search for the usage of `TimeStep`. Expect: Usage found in the file.
rg --type ts 'TimeStep' libs/windy-sounding/src/redux/meta.ts

Length of output: 162


Script:

#!/bin/bash
# Description: Verify the usage of `TimeStep` type across the entire codebase.

# Test: Search for the usage of `TimeStep`. Expect: Usage found in multiple files.
rg --type ts 'TimeStep'

Length of output: 378


Script:

#!/bin/bash
# Description: Extract context of `TimeStep` usage in `containers.tsx`.

# Test: Extract lines around the usage of `TimeStep` in `containers.tsx`. Expect: Detailed context of usage.
rg --type ts 'TimeStep' -A 10 libs/windy-sounding/src/containers/containers.tsx

Length of output: 780


73-80: Ensure correct implementation of changeModel thunk.

The changeModel thunk handles model updates and fetches forecasts. Verify that the implementation is correct and necessary.

Verification successful

The implementation of changeModel thunk is correct and necessary.

The changeModel thunk is properly used in libs/windy-sounding/src/sounding.tsx to handle the product event from windyStore, ensuring that the model is updated and forecasts are fetched accordingly.

  • libs/windy-sounding/src/sounding.tsx: Lines showing the import and dispatch of changeModel.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation of `changeModel` thunk.

# Test: Search for the usage of `changeModel`. Expect: Correct implementation found in the file.
rg --type ts 'changeModel' libs/windy-sounding/src/redux/meta.ts

Length of output: 91


Script:

#!/bin/bash
# Description: Search for the usage of `changeModel` throughout the codebase.

# Test: Search for the usage of `changeModel` in the entire codebase.
rg --type ts 'changeModel'

Length of output: 234


Script:

#!/bin/bash
# Description: Extract relevant lines from `libs/windy-sounding/src/sounding.tsx` to review the usage of `changeModel`.

# Extract lines around the usage of `changeModel` in `libs/windy-sounding/src/sounding.tsx`.
rg --type ts 'changeModel' -A 10 -B 10 libs/windy-sounding/src/sounding.tsx

Length of output: 1388


19-52: Ensure correct implementation of updateTime thunk.

The updateTime thunk handles time updates based on the TimeStep type. Verify that the implementation is correct and necessary.

Verification successful

The updateTime thunk is correctly implemented and necessary.

The updateTime thunk is used in libs/windy-sounding/src/sounding.tsx and libs/windy-sounding/src/containers/containers.tsx to handle time updates based on user interactions. The implementation aligns with the intended functionality, ensuring that time updates are handled appropriately based on the TimeStep type.

  • libs/windy-sounding/src/sounding.tsx: Dispatched on swipe events.
  • libs/windy-sounding/src/containers/containers.tsx: Dispatched on scroll events.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation of `updateTime` thunk.

# Test: Search for the usage of `updateTime`. Expect: Correct implementation found in the file.
rg --type ts 'updateTime' libs/windy-sounding/src/redux/meta.ts

Length of output: 89


Script:

#!/bin/bash
# Description: Verify the usage of `updateTime` thunk throughout the codebase.

# Test: Search for all instances where `updateTime` is used or referenced.
rg --type ts 'updateTime' 

Length of output: 452


Script:

#!/bin/bash
# Description: Extract the relevant lines of code where `updateTime` is used in the identified files.

# Extract lines around the usage of `updateTime` in libs/windy-sounding/src/sounding.tsx
rg --type ts -A 5 -B 5 'updateTime' libs/windy-sounding/src/sounding.tsx

# Extract lines around the usage of `updateTime` in libs/windy-sounding/src/containers/containers.tsx
rg --type ts -A 5 -B 5 'updateTime' libs/windy-sounding/src/containers/containers.tsx

Length of output: 1831

libs/windy-sounding/src/components/wind-profile.tsx (1)

5-19: Ensure correct usage of WindProfileProps type.

The WindProfileProps type declaration has been updated to remove conditional loading checks and directly define properties. Verify that this change is necessary and correctly implemented.

Verification successful

Ensure correct usage of WindProfileProps type.

The WindProfileProps type declaration is correctly used and implemented in the WindProfile function. The properties are actively utilized within the function's logic.

  • The WindProfile function destructures and uses all properties defined in WindProfileProps.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `WindProfileProps` type.

# Test: Search for the usage of `WindProfileProps`. Expect: Usage found in the file.
rg --type tsx 'WindProfileProps' libs/windy-sounding/src/components/wind-profile.tsx

Length of output: 112


Script:

#!/bin/bash
# Description: Verify the usage of `WindProfileProps` type.

# Test: Search for the usage of `WindProfileProps`. Expect: Usage found in the file.
rg 'WindProfileProps' libs/windy-sounding/src/components/wind-profile.tsx

Length of output: 161


Script:

#!/bin/bash
# Description: Extract the implementation of the WindProfile function to review its usage of WindProfileProps properties.

# Test: Extract the WindProfile function implementation.
rg -A 50 'export function WindProfile\(props: WindProfileProps\)' libs/windy-sounding/src/components/wind-profile.tsx

Length of output: 1846

libs/windy-sounding/src/redux/plugin-slice.ts (4)

13-23: Verify the necessity and correctness of new constants and enums.

Ensure that the new constants UPDATE_REQUIRED_AFTER_DAYS, SUPPORTED_MODEL_PREFIXES, and DEFAULT_MODEL, and the new enum PluginStatus are necessary and correctly implemented.

Verification successful

Verified the necessity and correctness of the new constants and enums.

The constants UPDATE_REQUIRED_AFTER_DAYS, SUPPORTED_MODEL_PREFIXES, DEFAULT_MODEL, and the enum PluginStatus are used in the file, indicating their necessity and correct implementation.

  • UPDATE_REQUIRED_AFTER_DAYS is used in a calculation.
  • SUPPORTED_MODEL_PREFIXES is used to check model names.
  • DEFAULT_MODEL is used as a fallback model name.
  • PluginStatus is used to manage and check the plugin's status.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of new constants and enums.

# Test: Search for the usage of `UPDATE_REQUIRED_AFTER_DAYS`, `SUPPORTED_MODEL_PREFIXES`, `DEFAULT_MODEL`, and `PluginStatus`. Expect: Usage found in the file.
rg --type ts 'UPDATE_REQUIRED_AFTER_DAYS|SUPPORTED_MODEL_PREFIXES|DEFAULT_MODEL|PluginStatus' libs/windy-sounding/src/redux/plugin-slice.ts

Length of output: 781


48-51: Ensure correct initialization of initialState.

The initialState declaration has been updated with new properties status, updateAvailable, updateRequired, and availableVersion. Verify that this change is necessary and correctly implemented.

Verification successful

Let's proceed with verifying the definition of PluginState and the usage of initialState to ensure the new properties are correctly implemented and utilized.


Initialization of initialState is correct and necessary.

The initialState declaration has been updated with new properties status, updateAvailable, updateRequired, and availableVersion. These properties are correctly included in the PluginState type and are properly initialized.

  • libs/windy-sounding/src/redux/plugin-slice.ts: Initialization of initialState with new properties.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the initialization of `initialState`.

# Test: Search for the usage of `initialState`. Expect: Correct initialization found in the file.
rg --type ts 'initialState' libs/windy-sounding/src/redux/plugin-slice.ts

Length of output: 125


Script:

#!/bin/bash
# Description: Verify the definition of `PluginState` and the usage of `initialState`.

# 1. Check the definition of `PluginState` to ensure it includes the new properties.
ast-grep --lang typescript --pattern 'type PluginState = { $$$ }' 

# 2. Verify the usage of `initialState` to ensure the new properties are utilized correctly.
rg --type ts 'initialState' 

Length of output: 2993


34-37: Ensure correct usage of PluginState type.

The PluginState type declaration has been updated with new properties status, updateAvailable, updateRequired, and availableVersion. Verify that this change is necessary and correctly implemented.

Verification successful

The PluginState type declaration and its new properties are correctly implemented.

The properties status, updateAvailable, updateRequired, and availableVersion are properly initialized in the initialState object and are used correctly throughout the file.

  • status is initialized with PluginStatus.Idle and used in selectors and reducers.
  • updateAvailable is initialized with false and used in selectors and reducers.
  • updateRequired is initialized with false and used in selectors and reducers.
  • availableVersion is initialized with an empty string and used in selectors and reducers.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `PluginState` type.

# Test: Search for the usage of `PluginState`. Expect: Usage found in the file.
rg --type ts 'PluginState' libs/windy-sounding/src/redux/plugin-slice.ts

Length of output: 129


Script:

#!/bin/bash
# Description: Verify the initialization and usage of new properties in `PluginState`.

# Test: Search for the initialization of `initialState` and usage of new properties.
rg 'initialState' -A 10 libs/windy-sounding/src/redux/plugin-slice.ts
rg 'status' libs/windy-sounding/src/redux/plugin-slice.ts
rg 'updateAvailable' libs/windy-sounding/src/redux/plugin-slice.ts
rg 'updateRequired' libs/windy-sounding/src/redux/plugin-slice.ts
rg 'availableVersion' libs/windy-sounding/src/redux/plugin-slice.ts

Length of output: 1990


98-116: Ensure correct implementation of fetchPluginConfig thunk.

The fetchPluginConfig thunk is added to fetch and update the plugin configuration. Verify that this thunk is necessary and correctly implemented.

Verification successful

The fetchPluginConfig thunk is correctly implemented and integrated into the codebase.

  • The fetchPluginConfig thunk is used in libs/windy-sounding/src/sounding.tsx.
  • All actions dispatched within the thunk (setUpdateAvailable, setUpdateRequired, setAvailableVersion, setStatus) are defined in the plugin-slice.ts file.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation of `fetchPluginConfig` thunk.

# Test: Search for the usage of `fetchPluginConfig`. Expect: Correct implementation found in the file.
rg --type ts 'fetchPluginConfig' libs/windy-sounding/src/redux/plugin-slice.ts

Length of output: 201


Script:

#!/bin/bash
# Description: Verify the usage and correct implementation of `fetchPluginConfig` thunk.

# Test 1: Search for the usage of `fetchPluginConfig` across the codebase.
rg --type ts 'fetchPluginConfig'

# Test 2: Verify that the actions dispatched within `fetchPluginConfig` are defined in the slice.
rg --type ts 'setUpdateAvailable' libs/windy-sounding/src/redux/plugin-slice.ts
rg --type ts 'setUpdateRequired' libs/windy-sounding/src/redux/plugin-slice.ts
rg --type ts 'setAvailableVersion' libs/windy-sounding/src/redux/plugin-slice.ts
rg --type ts 'setStatus' libs/windy-sounding/src/redux/plugin-slice.ts

Length of output: 1301

libs/windy-sounding/src/styles.less (4)

8-8: Comment looks good.

The comment is clear and concise.


9-13: Styles look good.

The styles for #wsp-update use CSS variables and are consistent with best practices.


109-111: Styles look good.

The styles for anchor tags use bold font weight and are consistent with best practices.


130-130: Styles look good.

The styles for .wsp-message use a light gray border and are consistent with best practices.

libs/windy-sounding/src/components/skewt.tsx (26)

8-31: Type definition looks good.

The SkewTProps type is comprehensive and well-structured.


57-57: Destructuring looks good.

The destructuring of props is clear and follows best practices.


79-79: Variable assignment looks good.

The assignment of ySurface is clear and follows best practices.


132-132: Props assignment looks good.

The assignment of props in the IsoTherm component is clear and follows best practices.


163-163: Element creation looks good.

The creation of the rect element is clear and follows best practices.


166-166: Conditional rendering looks good.

The conditional rendering of the g element is clear and follows best practices.


170-170: Text element looks good.

The creation of the text element is clear and follows best practices.


177-177: Text element looks good.

The creation of the text element is clear and follows best practices.


205-205: Function implementation looks good.

The DryAdiabatic function is well-structured and follows best practices.


229-229: Function implementation looks good.

The WetAdiabatic function is well-structured and follows best practices.


255-255: Function implementation looks good.

The IsoHume function is well-structured and follows best practices.


334-334: Function implementation looks good.

The AltitudeAxis function is well-structured and follows best practices.


132-132: Props assignment looks good.

The assignment of props in the IsoTherm component is clear and follows best practices.


163-163: Element creation looks good.

The creation of the rect element is clear and follows best practices.


166-166: Conditional rendering looks good.

The conditional rendering of the g element is clear and follows best practices.


170-170: Text element looks good.

The creation of the text element is clear and follows best practices.


177-177: Text element looks good.

The creation of the text element is clear and follows best practices.


205-205: Function implementation looks good.

The DryAdiabatic function is well-structured and follows best practices.


229-229: Function implementation looks good.

The WetAdiabatic function is well-structured and follows best practices.


255-255: Function implementation looks good.

The IsoHume function is well-structured and follows best practices.


334-334: Function implementation looks good.

The AltitudeAxis function is well-structured and follows best practices.


132-132: Props assignment looks good.

The assignment of props in the IsoTherm component is clear and follows best practices.


163-163: Element creation looks good.

The creation of the rect element is clear and follows best practices.


166-166: Conditional rendering looks good.

The conditional rendering of the g element is clear and follows best practices.


170-170: Text element looks good.

The creation of the text element is clear and follows best practices.


177-177: Text element looks good.

The creation of the text element is clear and follows best practices.

libs/windy-sounding/src/containers/containers.tsx (12)

3-4: Imports look good.

The imports from preact/hooks and react-redux are necessary for the functionality of the components.


8-8: Import looks good.

The import of the Message component is necessary for the functionality of the components.


10-10: Import looks good.

The import of the WindProfile component is necessary for the functionality of the components.


13-14: Imports look good.

The imports of forecast-slice and TimeStep are necessary for the functionality of the components.


17-18: Imports look good.

The imports of AppDispatch, RootState, and units-slice are necessary for the functionality of the components.


23-258: Function implementation looks good.

The Plugin function is well-structured and follows best practices. The changes include variable destructuring, hooks, and JSX elements.


263-321: Function implementation looks good.

The Graph function is well-structured and follows best practices. The changes include variable destructuring, hooks, and JSX elements.


334-373: Function implementation looks good.

The ConnectedSkewT function is well-structured and follows best practices. The changes include variable destructuring, hooks, and JSX elements.


377-413: Function implementation looks good.

The ConnectedWind function is well-structured and follows best practices. The changes include variable destructuring, hooks, and JSX elements.


417-429: Function implementation looks good.

The ConnectedFavorites function is well-structured and follows best practices. The changes include variable destructuring, hooks, and JSX elements.


Line range hint 440-471: Function implementation looks good.

The Details function is well-structured and follows best practices. The changes include variable destructuring, hooks, and JSX elements.


Line range hint 475-509: Function implementation looks good.

The Watermark function is well-structured and follows best practices. The changes include variable destructuring, hooks, and JSX elements.

libs/windy-sounding/src/redux/forecast-slice.ts (1)

1-46: Imports, types, and constants look good.

The imports, types, and constants are necessary for the functionality of the Redux slice.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 8

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c0a1a24 and c5d0a8a.

Files selected for processing (6)
  • libs/windy-sounding/CHANGELOG.md (1 hunks)
  • libs/windy-sounding/package.json (2 hunks)
  • libs/windy-sounding/src/components/loading.tsx (1 hunks)
  • libs/windy-sounding/src/containers/containers.tsx (3 hunks)
  • libs/windy-sounding/src/redux/forecast-slice.ts (1 hunks)
  • libs/windy-sounding/src/sounding.tsx (5 hunks)
Files skipped from review as they are similar to previous changes (4)
  • libs/windy-sounding/CHANGELOG.md
  • libs/windy-sounding/package.json
  • libs/windy-sounding/src/components/loading.tsx
  • libs/windy-sounding/src/sounding.tsx
Additional comments not posted (9)
libs/windy-sounding/src/containers/containers.tsx (8)

63-65: Add dependencies to selectFavorite useCallback.

The selectFavorite function uses dispatch and centerMap, which should be included in the dependency array.

- const selectFavorite = useCallback((location: LatLon) => {
+ const selectFavorite = useCallback((location: LatLon) => {
+   dispatch(changeLocation(location));
+   centerMap(location);
+ }, [dispatch, centerMap]);

68-76: Potential issue with isDragging state.

The isDragging variable is not part of the component state, which could lead to unexpected behavior if the component re-renders. Consider using a useRef to manage this variable.

- let isDragging = false;
+ const isDraggingRef = useRef(false);

100-114: Add dependencies to handleWheelEvent useCallback.

The handleWheelEvent function uses dispatch and ignoreWheelEventUntilMs, which should be included in the dependency array.

- const handleWheelEvent = useCallback((e: WheelEvent) => {
+ const handleWheelEvent = useCallback((e: WheelEvent) => {
+   const timeMs = Date.now();
+   if (timeMs > ignoreWheelEventUntilMs) {
+     const size = e.shiftKey || e.ctrlKey ? 'day' : 'hour';
+     const step: TimeStep = {
+       direction: Math.sign(e.deltaY) > 0 ? 'forward' : 'backward',
+       size,
+     };
+     dispatch(updateTime(step));
+     ignoreWheelEventUntilMs = Date.now() + (size === 'day' ? 500 : 10);
+   }
+   e.stopImmediatePropagation();
+   e.preventDefault();
+ }, [dispatch, ignoreWheelEventUntilMs]);

123-123: Avoid using any type.

Using any defeats the purpose of TypeScript. Consider defining a more specific type for errorMessage.

- let errorMessage: any;
+ let errorMessage: string | null = null;

131-131: Enhance accessibility.

To improve accessibility, consider adding a role and tabindex to the div acting as a button.

- <div className="button" role="button" tabIndex={0} onClick={openPluginMenu}>

241-241: Potential performance issue with inline function.

Passing an inline function to onSelected will cause the component to re-render every time its parent re-renders. Consider memoizing the function.

- <ConnectedFavorites onSelected={selectFavorite} />
+ const memoizedSelectFavorite = useCallback(selectFavorite, [selectFavorite]);
+ <ConnectedFavorites onSelected={memoizedSelectFavorite} />

511-512: LGTM!

The openPluginMenu function is simple and correct.


266-266: Add dependencies to setIsZoomedIn useCallback.

The setIsZoomedIn function uses dispatch, which should be included in the dependency array.

- const setIsZoomedIn = useCallback((expanded: boolean) => dispatch(pluginSlice.setIsZoomedIn(expanded)), []);
+ const setIsZoomedIn = useCallback((expanded: boolean) => dispatch(pluginSlice.setIsZoomedIn(expanded)), [dispatch]);
libs/windy-sounding/src/redux/forecast-slice.ts (1)

138-144: Consider adding error handling for network issues.

Currently, the error handling only checks for specific status codes. Consider adding a more general error handling mechanism for network issues.

- const [meteogram, forecast] = await Promise.allSettled([
+ const [meteogram, forecast] = await Promise.allSettled([
+   // extended is required to get full length forecast for pro windy users
+   windyFetch.getMeteogramForecastData(modelName, { ...location, step: 1 }, { extended: 'true' }),
+   windyFetch.getPointForecastData(modelName, { ...location }),
+ ]).catch((error) => {
+   throw new Error('Network error');
+ });

@vicb vicb changed the title Sounding release 4.0.0-alpha.3 Sounding release 4.0.0-beta.1 Jul 13, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

Outside diff range, codebase verification and nitpick comments (2)
libs/windy-sounding/src/containers/containers.tsx (2)

56-57: Potential issue with mobile height state.

Consider using a useRef for mobileHeight to avoid unnecessary re-renders.

- const [mobileHeight, setMobileHeight] = useState<number | undefined>();
+ const mobileHeightRef = useRef<number | undefined>();

123-123: Avoid using any type.

Using any defeats the purpose of TypeScript. Consider defining a more specific type for errorMessage.

- let errorMessage: any;
+ let errorMessage: string | JSX.Element | null = null;
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c5d0a8a and 75d4634.

Files selected for processing (8)
  • .github/workflows/upload-windy-sounding.yml (1 hunks)
  • libs/windy-sounding/CHANGELOG.md (1 hunks)
  • libs/windy-sounding/package.json (2 hunks)
  • libs/windy-sounding/project.json (1 hunks)
  • libs/windy-sounding/src/components/loading.tsx (1 hunks)
  • libs/windy-sounding/src/containers/containers.tsx (3 hunks)
  • libs/windy-sounding/src/redux/forecast-slice.ts (1 hunks)
  • libs/windy-sounding/src/sounding.tsx (5 hunks)
Files skipped from review as they are similar to previous changes (5)
  • libs/windy-sounding/CHANGELOG.md
  • libs/windy-sounding/package.json
  • libs/windy-sounding/src/components/loading.tsx
  • libs/windy-sounding/src/redux/forecast-slice.ts
  • libs/windy-sounding/src/sounding.tsx
Additional comments not posted (6)
.github/workflows/upload-windy-sounding.yml (1)

22-22: LGTM!

The added build step using npx nx build windy-sounding is correctly formatted and logically placed.

libs/windy-sounding/project.json (2)

66-67: LGTM!

The modified prepare target with additional build commands and the --skip-nx-cache flag is correctly formatted and logically placed.


75-84: LGTM!

The added upload target that depends on the prepare target and runs an upload script is correctly formatted and logically placed.

libs/windy-sounding/src/containers/containers.tsx (3)

3-18: LGTM!

The added imports are necessary for the updated component logic and state management.


333-367: Avoid using shallowEqual with large state objects.

Using shallowEqual with large state objects can lead to performance issues. Consider using a custom equality function or memoizing the selected state.

- const stateProps: Omit<SkewTProps, keyof ChildGraphProps> = useSelector((state: RootState) => {
-   const modelName = pluginSlice.selModelName(state);
-   const location = pluginSlice.selLocation(state);
-   const timeMs = pluginSlice.selTimeMs(state);
-   const periodValues = forecastSlice.selPeriodValues(state, modelName, location);
-   const timeValues = forecastSlice.selValuesAt(state, modelName, location, timeMs);
-   const isZoomedIn = pluginSlice.selIsZoomedIn(state);
-   const periodMaxTemp = forecastSlice.selMaxPeriodTemp(state, modelName, location);
-   const maxTemp = periodMaxTemp + 8;
-   const minTemp = periodMaxTemp - 60;
-   const formatTemp = unitsSlice.selTempFormatter(state);
-   return {
-     levels: periodValues.levels,
-     temps: timeValues.temp,
-     dewpoints: timeValues.dewpoint,
-     ghs: timeValues.gh,
-     seaLevelPressure: timeValues.seaLevelPressure,
-     minTemp,
-     maxTemp,
-     surfaceElevation: forecastSlice.selElevation(state, modelName, location),
-     parcel: forecastSlice.selDisplayParcel(state, modelName, location, timeMs)
-       ? forecastSlice.selParcel(state, modelName, location, timeMs)
-       : undefined,
-     formatAltitude: unitsSlice.selAltitudeFormatter(state),
-     formatTemp,
-

---

`68-77`: **Add `height` to `startResize` useCallback dependencies.**

The `startResize` function uses `height`, which should be included in the dependency array.

```diff
- const startResize = useCallback(
-   (e: PointerEvent) => {
-     isDragging = true;
-     yOnStartDrag = e.screenY;
-     heightOnStartDrag = height;
-     e.preventDefault();
-     e.stopImmediatePropagation();
-   },
-   [height],
- );
+ const startResize = useCallback(
+   (e: PointerEvent) => {
+     isDragging = true;
+     yOnStartDrag = e.screenY;
+     heightOnStartDrag = height;
+     e.preventDefault();
+     e.stopImmediatePropagation();
+   },
+   [height],
+ );

Likely invalid or redundant comment.

@vicb vicb merged commit e0f21d8 into master Jul 13, 2024
4 checks passed
@vicb vicb deleted the windy-api branch July 13, 2024 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant