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

feat(DEV-14165): product creation default values #598

Merged
merged 3 commits into from
Feb 27, 2025

Conversation

costa-monite
Copy link
Collaborator

@costa-monite costa-monite commented Feb 24, 2025

The Create component acts as an aggregator of default values, combining:

  • Base defaults
  • API-provided defaults
  • Parent-provided defaults (highest priority)

defaultValues logic:

  • Wait for data to load before setting defaults (units and entity settings)
  • Use first measure unit as default (measureUnits?.data?.[0]?.id)
  • Use entity's default currency (entitySettings?.currency?.default)

ProductForm.tsx

  • Removed redundant useMemo for defaultValues since they're already memoized in parent
  • Added form reset functionality using useEffect to handle default value changes

Copy link

changeset-bot bot commented Feb 24, 2025

🦋 Changeset detected

Latest commit: 9bd76aa

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

This PR includes changesets to release 1 package
Name Type
@monite/sdk-react 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

Copy link
Contributor

github-actions bot commented Feb 24, 2025

🚀 Preview URLs are now available! 🚀

@costa-monite costa-monite force-pushed the feat/DEV-14165-create-product-defaults branch from d5bbeac to b50d841 Compare February 27, 2025 09:26
@marcperezmonite marcperezmonite merged commit 1049a40 into main Feb 27, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pullpreview Generate a live preview for this pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants