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

Fix infinite execution of on updated method #29

Merged
merged 4 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ In the following table the list of parameters that can be provided to the `pdf_v
First, make sure that _RELEASE = False in `streamlit_pdf_viewer/__init__.py`. To run the component in development mode, use the following commands:

```shell
streamlit run my_component/__init__.py
streamlit run streamlit_pdf_viewer/__init__.py

cd frontend
npm run serve
Expand Down
11 changes: 7 additions & 4 deletions streamlit_pdf_viewer/frontend/src/PdfViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</template>

<script>
import {onMounted, onUpdated, computed, ref} from "vue";
import { onMounted, onUpdated, computed, ref} from "vue";
import "pdfjs-dist/build/pdf.worker.entry";
import {getDocument} from "pdfjs-dist/build/pdf";
import {Streamlit} from "streamlit-component-lib";
Expand All @@ -42,7 +42,7 @@
if (isRenderingAllPages) {
return props.args.annotations;
}
const filteredAnnotations = props.args.annotations.filter(anno =>{
const filteredAnnotations = props.args.annotations.filter(anno => {
return props.args.pages_to_render.includes(Number(anno.page))
})
return filteredAnnotations;
Expand Down Expand Up @@ -148,7 +148,7 @@

const alertError = (error) => {
window.alert(error.message);
console.error(error);

Check warning on line 151 in streamlit_pdf_viewer/frontend/src/PdfViewer.vue

View workflow job for this annotation

GitHub Actions / build (3.7, 18)

Unexpected console statement

Check warning on line 151 in streamlit_pdf_viewer/frontend/src/PdfViewer.vue

View workflow job for this annotation

GitHub Actions / build (3.8, 18)

Unexpected console statement

Check warning on line 151 in streamlit_pdf_viewer/frontend/src/PdfViewer.vue

View workflow job for this annotation

GitHub Actions / build (3.9, 18)

Unexpected console statement

Check warning on line 151 in streamlit_pdf_viewer/frontend/src/PdfViewer.vue

View workflow job for this annotation

GitHub Actions / build (3.10, 18)

Unexpected console statement

Check warning on line 151 in streamlit_pdf_viewer/frontend/src/PdfViewer.vue

View workflow job for this annotation

GitHub Actions / build (3.11, 18)

Unexpected console statement

Check warning on line 151 in streamlit_pdf_viewer/frontend/src/PdfViewer.vue

View workflow job for this annotation

GitHub Actions / build (3.12, 18)

Unexpected console statement
};

const loadPdfs = async (url) => {
Expand All @@ -167,7 +167,7 @@

const setFrameHeight = () => {
Streamlit.setFrameHeight(props.args.height || totalHeight.value);
Streamlit.setComponentReady();
// Streamlit.setComponentReady();
};

onMounted(() => {
Expand All @@ -178,7 +178,10 @@
setFrameHeight();
});

onUpdated(setFrameHeight);
onUpdated(() => {
setFrameHeight();
});


return {
filteredAnnotations,
Expand Down
Loading