Skip to content

hotfix/FDM256#257

Merged
SvenVw merged 3 commits into
mainfrom
FDM256
Aug 20, 2025
Merged

hotfix/FDM256#257
SvenVw merged 3 commits into
mainfrom
FDM256

Conversation

@SvenVw
Copy link
Copy Markdown
Collaborator

@SvenVw SvenVw commented Aug 20, 2025

Summary by CodeRabbit

  • New Features

    • None
  • Bug Fixes

    • Correctly preselects a field’s cultivation when adding a new field.
    • Field details form now uses unprefixed catalogue values for accurate defaults and resets.
    • Cultivations that start before the selected timeframe and have no end date are now shown.
    • Prevents setting harvest/end date equal to cultivation start date.
  • Performance

    • Increased calculation timeout to 30 seconds for longer runs.
  • Chores

    • Updated dependencies and bumped app/core versions.

Closes #256

@SvenVw SvenVw self-assigned this Aug 20, 2025
@SvenVw SvenVw added the branch:main An issue, affecting the main branch, that requires an hotfix label Aug 20, 2025
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Aug 20, 2025

🦋 Changeset detected

Latest commit: 5d348df

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@svenvw/fdm-app Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Aug 20, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Removes the "nl_" prefix from b_lu_catalogue initialization in the field form, aligning default values and reset logic with raw dataset values. Updates app and core changelogs and version numbers. Deletes three changeset files related to prior patches.

Changes

Cohort / File(s) Summary
Field form behavior
fdm-app/app/components/blocks/field/form.tsx
Initialize b_lu_catalogue from raw field.properties?.b_lu_catalogue ?? "" instead of prefixed nl_...; affects defaultValues, reset, and Combobox value.
App release metadata
fdm-app/CHANGELOG.md, fdm-app/package.json
Add 0.22.3 changelog entry and bump version 0.22.2 → 0.22.3.
Removed changesets
.changeset/clever-owls-attack.md, .changeset/fifty-hounds-flow.md, .changeset/great-boats-float.md
Delete three changeset entries related to prior patches.
Core release metadata
fdm-core/CHANGELOG.md, fdm-core/package.json
Add 0.24.1 changelog with two fixes; bump version 0.24.0 → 0.24.1.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor User
    participant NewFieldsPage as New Fields Page
    participant Dialog as FieldDetailsDialog
    participant Form as Form/Combobox

    User->>NewFieldsPage: Click "Nieuw perceel" and pick field
    NewFieldsPage->>Dialog: Open with field data
    Dialog->>Form: Initialize defaultValues
    Note over Form: b_lu_catalogue = field.properties.b_lu_catalogue || ""
    Form-->>User: Combobox shows selected cultivation (if present)
    User->>Form: Adjust/save
    Form->>Dialog: Submit values
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Assessment against linked issues

Objective Addressed Explanation
Preselect cultivation on Add Field page based on field data (#256)

Assessment against linked issues: Out-of-scope changes

[None]

Possibly related PRs

Suggested labels

fdm-core

Suggested reviewers

  • BoraIneviNMI
  • gerardhros

Poem

A nibble of code, a hop through the form,
I trimmed “nl_” to keep fields warm.
Now crops preselect with a gentle click,
No guessing games, the choice is slick.
Thump-thump! I ship, with ears held high—
Version bumps and changelogs fly. 🥕🐇

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 5d348df and c5f86ec.

📒 Files selected for processing (7)
  • .changeset/clever-owls-attack.md (0 hunks)
  • .changeset/fifty-hounds-flow.md (0 hunks)
  • .changeset/great-boats-float.md (0 hunks)
  • fdm-app/CHANGELOG.md (1 hunks)
  • fdm-app/package.json (1 hunks)
  • fdm-core/CHANGELOG.md (1 hunks)
  • fdm-core/package.json (1 hunks)
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch FDM256

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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>, please review it.
    • 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.
  • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 20, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.77%. Comparing base (9dcdc77) to head (5d348df).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #257   +/-   ##
=======================================
  Coverage   92.77%   92.77%           
=======================================
  Files          87       87           
  Lines       13030    13030           
  Branches     1289     1289           
=======================================
  Hits        12089    12089           
  Misses        939      939           
  Partials        2        2           
Flag Coverage Δ
fdm-calculator 94.15% <ø> (ø)
fdm-core 91.72% <ø> (ø)
fdm-data 94.37% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@SvenVw SvenVw linked an issue Aug 20, 2025 that may be closed by this pull request
@coderabbitai coderabbitai Bot added bug Something isn't working fdm-app labels Aug 20, 2025
Copy link
Copy Markdown
Contributor

@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

🧹 Nitpick comments (3)
.changeset/calm-feet-jump.md (1)

5-5: Clarify and fix grammar in changeset summary

Tighten the phrasing and use “on the New Fields page.” Also, make the intent explicit (preselect the cultivation of the chosen field).

Apply this diff:

-Fix that cultivation of selected field is shown when adding a new field at new fields page
+Ensure the selected field’s cultivation is preselected when adding a new field on the New Fields page
fdm-app/app/components/blocks/field/form.tsx (2)

44-44: Optional compatibility guard: auto-prefix if options are nl_-prefixed

If the options remain nl_-prefixed in other parts of the app, this small normalization preserves preselection without forcing a broader refactor right now.

Apply this diff:

-    const b_lu_catalogue = field.properties?.b_lu_catalogue ?? ""
+    const b_lu_catalogue_raw = field.properties?.b_lu_catalogue ?? ""
+    const b_lu_catalogue =
+        cultivationOptions.some((o) => o.value.startsWith("nl_")) &&
+        b_lu_catalogue_raw &&
+        !b_lu_catalogue_raw.startsWith("nl_")
+            ? `nl_${b_lu_catalogue_raw}`
+            : b_lu_catalogue_raw

49-52: Optional: provide a fallback when the dataset value is empty

If some fields come without b_lu_catalogue, consider defaulting to the first available option to ensure a selection is always present. This is optional and depends on product expectations.

Example (outside this hunk), for reference:

const firstOption = cultivationOptions[0]?.value ?? "";
const effectiveCatalogue = b_lu_catalogue || firstOption;

form.reset({
  b_name: fieldNameDefault,
  b_lu_catalogue: effectiveCatalogue,
});

Also applies to: 67-70

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 9dcdc77 and 8cb3c92.

📒 Files selected for processing (2)
  • .changeset/calm-feet-jump.md (1 hunks)
  • fdm-app/app/components/blocks/field/form.tsx (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-01-31T15:05:14.310Z
Learnt from: SvenVw
PR: SvenVw/fdm#67
File: fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id.tsx:601-610
Timestamp: 2025-01-31T15:05:14.310Z
Learning: The `updateField` function in fdm-core has optional parameters after `fdm` and `b_id`. The TypeScript definitions might show 8 required parameters due to a potential version mismatch.

Applied to files:

  • fdm-app/app/components/blocks/field/form.tsx
🪛 LanguageTool
.changeset/calm-feet-jump.md

[grammar] ~5-~5: There might be a mistake here.
Context: ... field is shown when adding a new field at new fields page

(QB_NEW_EN)

🔇 Additional comments (3)
.changeset/calm-feet-jump.md (1)

2-3: Patch bump scope looks correct

A UI-only bug fix in the app warrants a patch release. No public API changes implied here.

fdm-app/app/components/blocks/field/form.tsx (2)

44-44: Using the raw b_lu_catalogue value is the right call

This aligns the default selection with the dataset property and addresses the “no cultivation selected by default” issue when a field is picked.


44-44: Value Domain Consistency Verified

All b_lu_catalogue values in the form and its options use the same nl_*-prefixed codes:

• The loader passes b_lu_catalogue (always like "nl_265") into loaderData.
• Both <Combobox> option values and the form’s default value are set from that same prefixed string.
• No mappings drop or alter the "nl_" prefix.

There’s no mix of un-prefixed vs. prefixed codes—no further action needed.

@SvenVw SvenVw requested a review from BoraIneviNMI August 20, 2025 13:18
Copy link
Copy Markdown
Collaborator

@BoraIneviNMI BoraIneviNMI left a comment

Choose a reason for hiding this comment

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

OK the problem seems fixed now.

@SvenVw SvenVw merged commit 0cf73cd into main Aug 20, 2025
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

branch:main An issue, affecting the main branch, that requires an hotfix bug Something isn't working fdm-app fdm-core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add field page does not set the cultivation option dropdown to anything

2 participants