prismic-next icon indicating copy to clipboard operation
prismic-next copied to clipboard

feat: refresh data client-side on preview updates

Open angeloashmore opened this issue 3 years ago • 2 comments

Types of changes

  • [ ] Chore (a non-breaking change which is related to package maintenance)
  • [ ] Bug fix (a non-breaking change which fixes an issue)
  • [x] New feature (a non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)

Description

This PR allows a page to refresh its preview content without reloading the whole page. This happens when a document is edited + saved while a preview session is open.

When a document is published, the page will continue to perform a full refresh as it did before this PR. A full refresh is currently the only way to hide/reset the Prismic toolbar.

The changes in this PR should result in slightly quicker preview updates and a less jarring preview experience.

Checklist:

  • [ ] My change requires an update to the official documentation.
  • [x] All TSDoc comments are up-to-date and new ones have been added where necessary.
  • [ ] All new and existing tests are passing.

🪸

angeloashmore avatar May 25 '22 03:05 angeloashmore

Codecov Report

Merging #29 (b37ab54) into main (9527e85) will increase coverage by 0.00%. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main      #29   +/-   ##
=======================================
  Coverage   99.84%   99.85%           
=======================================
  Files          11       11           
  Lines         661      668    +7     
  Branches       31       31           
=======================================
+ Hits          660      667    +7     
  Partials        1        1           
Impacted Files Coverage Δ
src/PrismicPreview.tsx 100.00% <100.00%> (ø)

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 9527e85...b37ab54. Read the comment docs.

codecov-commenter avatar May 25 '22 03:05 codecov-commenter

size-limit report 📦

Path Size
./dist/index.cjs 5.93 KB (+0.27% 🔺)
./dist/index.js 2.76 KB (+0.57% 🔺)

github-actions[bot] avatar May 25 '22 03:05 github-actions[bot]

This functionality has been built into PR #63.

angeloashmore avatar May 06 '23 05:05 angeloashmore