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

Improve performance of demo workspace - Rename getImageAbsoluteURIOrBase64 function #6282

Merged
merged 3 commits into from
Jul 29, 2024

Conversation

gitstart-app[bot]
Copy link
Contributor

@gitstart-app gitstart-app bot commented Jul 16, 2024

Description

  1. This PR is a continuation of a previous PR: Improve performance of demo workspace #6201 (review)

  2. One test case was removed here: packages/twenty-front/src/utils/image/__tests__/getImageAbsoluteURI.test.ts because since we are not handling base64 images anymore, the result is the same of the last test case. Would you rather we update the test instead?

Refs

Demo

https://www.loom.com/share/4f32b535c77a4d418e319b095d09452c?sid=df34adf8-b013-44ef-b794-d54846f52d2d

Fixes #3514

@gitstart-twenty gitstart-twenty marked this pull request as draft July 16, 2024 11:09
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

  • Renamed getImageAbsoluteURIOrBase64 to getImageAbsoluteURI across multiple files.
  • Removed base64 image handling in getImageAbsoluteURI.
  • Updated avatar URL handling in components like ParticipantChip.tsx, CommentHeader.tsx, and CalendarEventRow.tsx.
  • Replaced base64 encoded images with URLs in seed data files (workspaces.ts).
  • Added new tests for getImageAbsoluteURI and removed old tests for getImageAbsoluteURIOrBase64.

28 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

@gitstart-twenty gitstart-twenty marked this pull request as ready for review July 16, 2024 11:34
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

  • Removed base64 image handling in getImageAbsoluteURI function across multiple files.
  • Updated send-invite-link.email.tsx to use getImageAbsoluteURI.
  • Modified CalendarEventRow.tsx, CommentHeader.tsx, and ParticipantChip.tsx to use getImageAbsoluteURI.
  • Updated seed data files (workspaces.ts) to use URLs instead of base64 images.
  • Deleted redundant test file getImageAbsoluteURIOrBase64.test.ts.

28 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

@lucasbordeau
Copy link
Contributor

lucasbordeau commented Jul 22, 2024

Could you please try to put the calls to this utils only in Avatar-like components, as it's called way too many times and creates an implicit pattern we have to memorize each time we work with avatarUrl instead of just passing whatever URL form we have to the avatar component that will try by itself to create an absoluteURI, because that's its job.

@gitstart-twenty
Copy link
Contributor

Hello @lucasbordeau 👋
Could you talk a little more about this? We didn't change the way the function is used, do you mean that instead of calling the function in each component, make the avatar component just receive the prop and use getImageAbsoluteURI internally?

@lucasbordeau
Copy link
Contributor

@gitstart-twenty Yes exactly ! We should call this function internally and developers shouldn't think about passing an absolute or relative URL, the Avatar component should take both.

Copy link
Contributor

@gitstart-twenty gitstart-twenty left a comment

Choose a reason for hiding this comment

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

Hello @lucasbordeau
About this comment we are duplicating the code on twenty-ui package because we are not sure if we should export the helper function from twenty-ui or keep the duplicated file as already is done on the email package

Does not seems correct to import the original helper function on Avatar component from twenty-front because the correct flow would be the twenty-front package using the twenty-ui package, so that's why it is duplicated, let us know if this is fine for you.

@lucasbordeau lucasbordeau merged commit fed12dd into main Jul 29, 2024
11 of 12 checks passed
@lucasbordeau lucasbordeau deleted the TWNTY-3514-1 branch July 29, 2024 12:07
Copy link

Fails
🚫

node failed.

Log

�[31mError: �[39m SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
�[90m    at parseJSONFromBytes (node:internal/deps/undici/undici:5584:19)�[39m
�[90m    at successSteps (node:internal/deps/undici/undici:5555:27)�[39m
�[90m    at fullyReadBody (node:internal/deps/undici/undici:1665:9)�[39m
�[90m    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)�[39m
�[90m    at async specConsumeBody (node:internal/deps/undici/undici:5564:7)�[39m
danger-results://tmp/danger-results-55129f45.json

Generated by 🚫 dangerJS against 0b00ae0

@lucasbordeau
Copy link
Contributor

@gitstart-twenty Of course DRY is not an absolute law, it should be put into context, here it's relevant to copy things until we find a good way to handle everything properly, maybe a twenty-shared or twenty-utils package could be interesting ? We'll talk about that with the core team.

lucasbordeau added a commit that referenced this pull request Jul 29, 2024
This PR fixes CI problems post merge of
#6282

CI often crashes because some TS files aren't included during
development and developers push errors on their PR.

Created an issue to mitigate this :
#6436
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve performance of demo workspace
2 participants