Skip to content

Commit

Permalink
Fix issue where Instantclick navigation fails (forem#1047)
Browse files Browse the repository at this point in the history
  • Loading branch information
benhalpern authored Oct 31, 2018
1 parent ebd4b50 commit 299e6ae
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions app/javascript/packs/githubRepos.jsx
Original file line number Diff line number Diff line change
@@ -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(<GithubRepos />, root, root.firstElementChild);
}
}

render(<GithubRepos />, root, root.firstElementChild);
window.InstantClick.on('change', () => {
loadElement();
});

loadElement();

0 comments on commit 299e6ae

Please sign in to comment.