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

fix: defaultValues computed on new globals #4380

Merged
merged 2 commits into from
Dec 4, 2023

Conversation

DanRibbens
Copy link
Contributor

Description

This change makes it so that when a field has defaultValue set it will be returned on globals even before the document has been created.

This change has a side-effect, if you had a collection document that was saved prior to a defaultValue existing on the config, when read, the document will have the new defaultValue that was undefined before.

  • I have read and understand the CONTRIBUTING.md document in this repository.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have added tests that prove my fix is effective or that my feature works
  • Existing test suite passes locally with my changes

@DanRibbens DanRibbens merged commit b6cffce into main Dec 4, 2023
29 checks passed
@DanRibbens DanRibbens deleted the fix/defaultvalue-new-globals branch December 4, 2023 20:05
@xHomu
Copy link
Contributor

xHomu commented Dec 9, 2023

This seems to cause default value to trigger on read. Is that intended?

@DanRibbens
Copy link
Contributor Author

@xHomu only when a value is not already present in the database. Is this causing an issue for you?

@xHomu
Copy link
Contributor

xHomu commented Dec 9, 2023

I'll try to narrow down the exact scenario and try to create a reproduction.

@xHomu
Copy link
Contributor

xHomu commented Dec 9, 2023

defaultValue: ({user}) => user.id would trigger an id not found error on read. I was able to fix it by simply change it to user?.id in manawiki/mana#225

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.

2 participants