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(core): raw response support #51

Merged
merged 8 commits into from
Mar 28, 2020
Merged

feat(core): raw response support #51

merged 8 commits into from
Mar 28, 2020

Conversation

jackyef
Copy link
Owner

@jackyef jackyef commented Mar 28, 2020

#50

Feature

We now have a new DataOptions, raw?: boolean defaults to false.

With this PR:

  1. We now only store the raw response string in DataClient.cache
  2. Each hooks will call JSON.parse if DataOptions.raw === false (the default is false). There is also a simple caching mechanism to avoid calling JSON.parse repeatedly.
  3. If DataOptions.raw === true, we simply return the stored raw response string

Bug Fix

Change the cache data structure to avoid collision with nested URL paths

Screen Shot 2020-03-28 at 16 35 12

@codesandbox-ci
Copy link

codesandbox-ci bot commented Mar 28, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit e42e353:

Sandbox Source
elegant-ritchie-6lz8r Configuration

@codecov
Copy link

codecov bot commented Mar 28, 2020

Codecov Report

Merging #51 into master will increase coverage by 0.13%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #51      +/-   ##
==========================================
+ Coverage   96.23%   96.37%   +0.13%     
==========================================
  Files          28       28              
  Lines         372      386      +14     
  Branches       90       96       +6     
==========================================
+ Hits          358      372      +14     
  Misses         14       14
Impacted Files Coverage Δ
...act-isomorphic-data/src/common/utils/addToCache.ts 100% <100%> (ø) ⬆️
...es/react-isomorphic-data/src/common/preloadData.ts 100% <100%> (ø) ⬆️
...morphic-data/src/common/utils/retrieveFromCache.ts 100% <100%> (ø) ⬆️
...act-isomorphic-data/src/hooks/utils/useBaseData.ts 87.35% <100%> (+1.28%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f7cafc3...e42e353. Read the comment docs.

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