Skip to content

fix: handle first-time item insertion during comparison - #368

Open
rahul-arb wants to merge 1 commit into
frappe:developfrom
rahul-arb:fix/new-item-comparison
Open

fix: handle first-time item insertion during comparison#368
rahul-arb wants to merge 1 commit into
frappe:developfrom
rahul-arb:fix/new-item-comparison

Conversation

@rahul-arb

@rahul-arb rahul-arb commented Jun 29, 2026

Copy link
Copy Markdown

Summary

This PR fixes an issue where the website item update logic fails for newly created Items because it attempts to compare the current document with a previous version that does not exist.

Root Cause

During the initial insert, there is no previous document available. The existing comparison logic assumes one exists, resulting in an exception.

Solution

  • Added a guard condition to detect first-time inserts.
  • Skip the comparison when no previous document is available.
  • Preserve the existing comparison behavior for document updates.

Testing

  • ✅ Created a new Item and verified that no exception is raised.
  • ✅ Updated an existing Item and verified that the comparison logic continues to work as expected.
  • ✅ Confirmed that existing functionality remains unchanged for update operations.

Fixes issue Issue no 367

@mergify

mergify Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@greptile-apps

greptile-apps Bot commented Jun 29, 2026

Copy link
Copy Markdown

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.
  • The guarded path is only inside the existing Website Item sync block.
  • Normal updates still compare against the previous Item document before syncing fields.

Important Files Changed

Filename Overview
webshop/webshop/crud_events/item/update_website_item.py Adds a defensive return before comparing editable Item fields when no previous document is available.

Reviews (1): Last reviewed commit: "fix: handle first-time item insertion du..." | Re-trigger Greptile

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