Skip to content

Commit 31a6c8f

Browse files
authored
Merge pull request #31 from oslabs-beta/rydang/treeinitial
added delay before initial state is sent to content script
2 parents 26c2e5e + 0bbf804 commit 31a6c8f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

package/linkFiber.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ module.exports = (snap, mode) => {
6565
const { _reactRootContainer: { _internalRoot } } = container;
6666
fiberRoot = _internalRoot;
6767
updateSnapShotTree();
68-
sendSnapshot();
68+
69+
// send the initial snapshot once the content script has started up
70+
window.addEventListener('message', ({ data: { action } }) => {
71+
if (action === 'contentScriptStarted') sendSnapshot();
72+
});
6973
};
7074
};

0 commit comments

Comments
 (0)