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

enhance: Schemas with no entities should not infer #323

Merged
merged 1 commit into from
Apr 26, 2020

Conversation

ntucker
Copy link
Collaborator

@ntucker ntucker commented Apr 26, 2020

Motivation

Better support simple response endpoints.

With no entities, denormalization is pointless. However, what's worse is since it found all the entities it needed (since it didn't need any) - it will attempt to infer results. Inferring results is non-nonsensical with no entities as it would just be returning the schema.

Solution

Add simple schemaHasEntity() algorithm to determine whether a schema has entities. When it doesn't we short-circuit the de-normalization computation.

@github-actions
Copy link
Contributor

Size Change: +273 B (1%)

Total Size: 26.9 kB

Filename Size Change
packages/rest-hooks/dist/index.cjs.js 15.6 kB +190 B (1%)
packages/rest-hooks/dist/index.umd.min.js 6.98 kB +83 B (1%)
ℹ️ View Unchanged
Filename Size Change
packages/legacy/dist/index.cjs.js 433 B 0 B
packages/legacy/dist/index.umd.min.js 376 B 0 B
packages/test/dist/index.cjs.js 1.89 kB 0 B
packages/use-enhanced-reducer/dist/index.cjs.js 1.08 kB 0 B
packages/use-enhanced-reducer/dist/index.umd.min.js 593 B 0 B

compressed-size-action

@ntucker ntucker requested a review from nickcherry April 26, 2020 01:14
@ntucker ntucker merged commit 79f048d into master Apr 26, 2020
@ntucker ntucker deleted the schema-no-entities branch April 26, 2020 01:16
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.

None yet

1 participant