Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove ramda from render #1834

Merged
merged 1 commit into from
May 29, 2022
Merged

Conversation

diegomura
Copy link
Owner

@diegomura diegomura commented May 28, 2022

Summary

Gradually start removing ramda. Although I like it, it's probably confusing for most people, it's slow and adds unneccesary bundle size. Some helper fns will still be needed. For the moment I moved them to utils dir, in the future it worths building our own set of light and reusable utils

@diegomura diegomura marked this pull request as ready for review May 28, 2022 21:39
@diegomura diegomura force-pushed the dm/remove-ramda-from-render branch 2 times, most recently from 3acb5a2 to 80ab6a6 Compare May 28, 2022 22:02
@diegomura diegomura force-pushed the dm/remove-ramda-from-render branch from 80ab6a6 to afb2ffc Compare May 29, 2022 20:15
@diegomura diegomura merged commit 7e97bb5 into master May 29, 2022
@diegomura diegomura deleted the dm/remove-ramda-from-render branch May 29, 2022 20:21
Comment on lines +173 to +179
const renderFn = renderFns[node.type];

if (renderFns) {
renderFn(ctx, node);
} else {
console.warn(`SVG node of type ${node.type} is not currenty supported`);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello,

I was going through the code and I noticed a small potential oversight. It seems that the condition if (renderFns) would always evaluate to true given the nature of JavaScript's truthy/falsy evaluation. I believe it might have been intended to be if (renderFn) to check for the existence of the specific render function:

  const renderFn = renderFns[node.type];

  if (renderFn) {
    renderFn(ctx, node);
  } else {
    console.warn(`SVG node of type ${node.type} is not currently supported`);
  }

Thank you for all your hard work on this repository. I hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants