diff --git a/app/javascript/packs/githubRepos.jsx b/app/javascript/packs/githubRepos.jsx index 511a95e13..d00fb0319 100644 --- a/app/javascript/packs/githubRepos.jsx +++ b/app/javascript/packs/githubRepos.jsx @@ -1,8 +1,15 @@ import { h, render } from 'preact'; import { GithubRepos } from '../githubRepos/githubRepos'; -document.addEventListener('DOMContentLoaded', () => { +function loadElement() { const root = document.getElementById('github-repos-container'); + if (root){ + render(, root, root.firstElementChild); + } +} - render(, root, root.firstElementChild); +window.InstantClick.on('change', () => { + loadElement(); }); + +loadElement();