Prevent domify from making unnecessary network requests - #582
Conversation
|
And presumably solves possible issue mentioned in this comment. |
| export default async () => { | ||
| const myUsername = getUsername(); | ||
| const cache = (await getCachedUsers())[storageKey] || {}; | ||
| const cache = (await getCachedUsers())[storageKey]; |
|
@bfred-it Can you review the changes? |
fregante
left a comment
There was a problem hiding this comment.
The variable fragment is an element and the variable content is a fragment, can you fix the naming?
Also the last comment mentions returning the template but it's actually returning the fragment.
export default html => {
const template = document.createElement('template');
template.innerHTML = html;
const fragment = template.content;
// If it's a single element, return just the element
if (fragment.firstChild === fragment.lastChild) {
return fragment.firstChild;
}
// Return fragment for querying
return fragment; // <-- Should this be `fragment` or `template`?
};@bfred-it Is this good enough? |
|
Yep! That'd be good! The last line is |
|
Fixed it! |
|
Excellent! I tested this in show-names (currently the only place where it's used) About #581 (comment): feel free to open issues when you encounter possible bugs. Sometimes it's hard to focus on one discussion if unrelated requests mix in. |
|
#591 solves #581 (comment) |

document.createRange().createContextualFragmenthelps in creating a document fragment by parsing HTML but additionally loads resources linked from the HTML.This is solved by using the HTML
templatetag.