Skip to content

fix(custom-data-link): allow falsey values for resources#1112

Merged
mediremi merged 2 commits intomasterfrom
fix/custom-data-link-fail-on-miss
Feb 8, 2022
Merged

fix(custom-data-link): allow falsey values for resources#1112
mediremi merged 2 commits intomasterfrom
fix/custom-data-link-fail-on-miss

Conversation

@mediremi
Copy link
Copy Markdown
Contributor

Currently it is not possible to use falsey (e.g. false, null, '', 0, ...) values for resources when using CustomDataProvider.

// This throws the error 'No data provided for resource type <resource name>!'
<CustomDataProvider data={mockData}>
  <SomeComponent />
</CustomDataProvider>

This PR fixes that by only treating a resource as unavailable if its value is undefined (when using the CustomDataLink link).

@mediremi mediremi requested a review from amcgee January 19, 2022 16:19
Copy link
Copy Markdown
Contributor

@amcgee amcgee left a comment

Choose a reason for hiding this comment

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

LGTM!

@mediremi mediremi enabled auto-merge (squash) February 8, 2022 08:12
@mediremi mediremi merged commit 75f3528 into master Feb 8, 2022
@mediremi mediremi deleted the fix/custom-data-link-fail-on-miss branch February 8, 2022 08:18
dhis2-bot added a commit that referenced this pull request Feb 8, 2022
## [3.2.9](v3.2.8...v3.2.9) (2022-02-08)

### Bug Fixes

* **custom-data-link:** allow falsey values for resources ([#1112](#1112)) ([75f3528](75f3528))
@dhis2-bot
Copy link
Copy Markdown
Contributor

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants