Skip to content

Commit

Permalink
refactor: merge loadScripts handling
Browse files Browse the repository at this point in the history
Co-authored-by shuding <g@shud.in>
  • Loading branch information
SukkaW committed Aug 27, 2022
1 parent 2606ea8 commit 1888680
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/next/client/script.tsx
Expand Up @@ -82,10 +82,6 @@ const loadScript = (props: ScriptProps): void => {
}
})

if (src) {
ScriptCache.set(src, loadPromise)
}

if (dangerouslySetInnerHTML) {
el.innerHTML = dangerouslySetInnerHTML.__html || ''

Expand All @@ -105,6 +101,8 @@ const loadScript = (props: ScriptProps): void => {
el.src = src
// do not add cacheKey into LoadCache for remote script here
// cacheKey will be added to LoadCache when it is actually loaded (see loadPromise above)

ScriptCache.set(src, loadPromise)
}

for (const [k, value] of Object.entries(props)) {
Expand Down

0 comments on commit 1888680

Please sign in to comment.