Skip to content

Commit

Permalink
Fix Prism Vue component not re-rendering
Browse files Browse the repository at this point in the history
For some reason it doesn't reflect changes anymore, so we force the
Prism component to update by adding a `:key`
  • Loading branch information
RoelN committed Dec 23, 2024
1 parent ba578d9 commit 879b6e3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/report/StyleSheet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</div>
<div class="code">
<CopyToClipboard :content="css" />
<Prism language="css">{{ css }}</Prism>
<Prism language="css" :key="{ css }">{{ css }}</Prism>
</div>
</div>
<div v-else>
Expand Down
6 changes: 4 additions & 2 deletions src/components/report/TypeTester.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,12 @@
@unlinkOpticalSize="unlinkOpticalSize"
/>
<div class="code">
<Prism language="html" v-if="hasLocalization">{{ html }}</Prism>
<Prism language="html" v-if="hasLocalization" :key="{ html }">{{
html
}}</Prism>
<div class="code-styles">
<CopyToClipboard :content="styles" />
<Prism language="css">{{ styles }}</Prism>
<Prism language="css" :key="{ styles }">{{ styles }}</Prism>
</div>
</div>
</div>
Expand Down
4 changes: 3 additions & 1 deletion src/components/report/VariableControls.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@
</div>
<div class="code" v-if="showStyles">
<CopyToClipboard :content="variableStyles" />
<Prism language="css">{{ variableStyles }}</Prism>
<Prism language="css" :key="{ variableStyles }">{{
variableStyles
}}</Prism>
</div>
</div>
</template>
Expand Down

0 comments on commit 879b6e3

Please sign in to comment.