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

[batchGet] Use original item when comparing keys #1607

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gbasto
Copy link

@gbasto gbasto commented May 30, 2023

Summary:

When using batchGet, it prepares the response by searching the items from a temp result by comparing their keys. Problem is that if these items have any transformation on their keys, they will never be found because the original keys are used in the search, always resulting in an empty response.

GitHub linked issue:

Closes #1442

Other information:

I've opted to put the original object in a temporary variable inside find to avoid multiple calls to item.original(). Alternatively we could one line with residual performance impact:

const item = tmpResult.find((item) => keyProperties.every((keyProperty) => item.original()[keyProperty] === key[keyProperty]));

Type (select 1):

  • Bug fix
  • Feature implementation
  • Documentation improvement
  • Testing improvement
  • Test added to report bug (GitHub issue #---- @---)
  • Something not listed here

Is this a breaking change? (select 1):

  • 🚨 YES 🚨
  • No
  • I'm not sure

Is this ready to be merged into Dynamoose? (select 1):

  • Yes
  • No

Are all the tests currently passing on this PR? (select 1):

  • Yes
  • No

Other:

  • I have read through and followed the Contributing Guidelines
  • I have searched through the GitHub pull requests to ensure this PR has not already been submitted
  • I have updated the Dynamoose documentation (if required) given the changes I made
  • I have added/updated the Dynamoose test cases (if required) given the changes I made
  • I agree that all changes made in this pull request may be distributed and are made available in accordance with the Dynamoose license
  • All of my commits and commit messages are detailed, explain what changes were made, and are easy to follow and understand
  • I have filled out all fields above

@github-actions
Copy link
Contributor

github-actions bot commented May 30, 2023

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@gbasto
Copy link
Author

gbasto commented May 30, 2023

I dedicate any and all copyright interest in this software to the public domain. I make this dedication for the benefit of the public at large and to the detriment of my heirs and successors. I intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.

github-actions bot added a commit that referenced this pull request May 30, 2023
@gbasto
Copy link
Author

gbasto commented May 30, 2023

recheck

@gbasto gbasto changed the title [batchGet] Use orignal item when comparing keys [batchGet] Use original item when comparing keys May 30, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jun 8, 2023

This pull request is stale because it has been open 7 days with no activity. Remove stale label or comment or this will be closed in 3 days.

@gbasto
Copy link
Author

gbasto commented Sep 12, 2023

👋 @fishcharlie is there any interest in merging this PR? Otherwise I'll just close it as it's tickling my OCD anytime I look into my open PRs and I always find this one stalled there 😅

Copy link
Member

@fishcharlie fishcharlie left a comment

Choose a reason for hiding this comment

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

@gbasto I'm so sorry for the delay here. Yes there is interest in this PR. It needs some automated tests to ensure regressions don't happen in the future tho.

Any chance you'd be willing to add those?

These tests should fail without the changes you made in this PR, and should pass with the changes you made in this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] batchGet returns an empty array if the string manipulation is done using get in model
2 participants