Skip to content

Commit

Permalink
Fix/style not match (#6521)
Browse files Browse the repository at this point in the history
* fix: fix style not match when hydrate

* chore: add changeset
  • Loading branch information
answershuto authored Sep 8, 2023
1 parent b748810 commit a04cc00
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/metal-readers-drum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@ice/cache-canvas': patch
---

fix: fix style not match when hydrate
9 changes: 4 additions & 5 deletions packages/cache-canvas/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,9 @@ export const CacheCanvas = forwardRef((props: CacheCanvasProps, ref) => {
{
(typeof fallback === 'function') && (<div
id={`fallback-${id}`}
style={isNode || Storage.getItem(cacheKey, { bizID }) ? { display: 'none' } : { display: 'block' }}
>
{
fallback()
(isNode || !Storage.getItem(cacheKey, { bizID })) && fallback()
}
</div>)
}
Expand Down Expand Up @@ -155,9 +154,9 @@ export const CacheCanvas = forwardRef((props: CacheCanvasProps, ref) => {
if (base64Data) {
const img = document.getElementById('canvas-img-${id}');
img && (img.src = base64Data);
fallback && (fallback.style.display = 'none');
} else {
fallback && (fallback.style.display = 'block');
if (fallback && fallback.childNodes[0]) {
fallback.removeChild(fallback.childNodes[0]);
}
}
`,
}}
Expand Down

0 comments on commit a04cc00

Please sign in to comment.