Skip to content

Commit 404bfd4

Browse files
authored
Merge pull request #29 from lfoppiano/fix/infinite-execution-of-onUpdated-method
Fix infinite execution of on updated method
2 parents c354d1d + f122aa2 commit 404bfd4

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ In the following table the list of parameters that can be provided to the `pdf_v
5353
First, make sure that _RELEASE = False in `streamlit_pdf_viewer/__init__.py`. To run the component in development mode, use the following commands:
5454

5555
```shell
56-
streamlit run my_component/__init__.py
56+
streamlit run streamlit_pdf_viewer/__init__.py
5757

5858
cd frontend
5959
npm run serve

streamlit_pdf_viewer/frontend/src/PdfViewer.vue

+7-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
</template>
2323

2424
<script>
25-
import {onMounted, onUpdated, computed, ref} from "vue";
25+
import { onMounted, onUpdated, computed, ref} from "vue";
2626
import "pdfjs-dist/build/pdf.worker.entry";
2727
import {getDocument} from "pdfjs-dist/build/pdf";
2828
import {Streamlit} from "streamlit-component-lib";
@@ -42,7 +42,7 @@ export default {
4242
if (isRenderingAllPages) {
4343
return props.args.annotations;
4444
}
45-
const filteredAnnotations = props.args.annotations.filter(anno =>{
45+
const filteredAnnotations = props.args.annotations.filter(anno => {
4646
return props.args.pages_to_render.includes(Number(anno.page))
4747
})
4848
return filteredAnnotations;
@@ -167,7 +167,7 @@ export default {
167167
168168
const setFrameHeight = () => {
169169
Streamlit.setFrameHeight(props.args.height || totalHeight.value);
170-
Streamlit.setComponentReady();
170+
// Streamlit.setComponentReady();
171171
};
172172
173173
onMounted(() => {
@@ -178,7 +178,10 @@ export default {
178178
setFrameHeight();
179179
});
180180
181-
onUpdated(setFrameHeight);
181+
onUpdated(() => {
182+
setFrameHeight();
183+
});
184+
182185
183186
return {
184187
filteredAnnotations,

0 commit comments

Comments
 (0)