Fork me on GitHub
#reagent
<
2017-12-15
>
shen07:12:18

Hey. This feels like one of those questions that should have a quick answer: how do we sanitise HTML against XSS when using {:dangerouslySetInnerHTML {:__html ... }}? I see that DOMPurify is the answer in regular React world, but it's not in cljsjs

shen07:12:18

I assume this is because it either doesn't work for some reason, or is not required?

juhoteperi07:12:35

@shen Or most likely, no one has needed it, so it is not packaged

shen07:12:38

surely someone has needed to do this at some stage?

shen07:12:17

Is it a weird thing to try to do? render stored HTML in a reagent component?

borkdude15:12:49

is it possible to throttle re-rendering of children? e.g. I have a component which receives a width from the parent component, but when a CSS animation is running it receives it often, which makes the animation very slow because of the re-renders

borkdude15:12:22

so I want to throttle the propagation of the width to the children by let’s say 0.2s of something

manutter5116:12:31

You could do something like create a buffered-width and set the child width based on that. Then you could for example track the last time buffered-width was updated. When a new parent width comes in, if less than 0.2s has gone by, ignore it, otherwise update it. Since the value of buffered-width isn’t changing, it won’t redraw the child width

manutter5116:12:22

You’d probably want to add a setTimeout in there somewhere to make sure you don’t end up losing the last width change or 3.

borkdude16:12:33

yeah, that would work

borkdude16:12:44

goog.functions/throttle is very helpful here