Sitelet https://web.archive.org/web/20220101163744/https://github.com/hoppscotch/hoppscotch/issues/1896
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

Generalize changes to lenses renderers #1896

Open
sguzmanm opened this issue Oct 24, 2021 · 3 comments
Open

Generalize changes to lenses renderers #1896

sguzmanm opened this issue Oct 24, 2021 · 3 comments

Comments

@sguzmanm
Copy link
Contributor

@sguzmanm sguzmanm commented Oct 24, 2021

Is your feature request related to a problem? Please describe.
Mostly maintainability and code readability. When you make a change to any of these renderers you are forced to copy the same code more than three times

Describe the solution you'd like
A global component for rendering the response that receives as inputs:

  • The response
  • List of actions and a callback for each of these actions
  • List of renderers. We could standardize these renderers by using an interface for specifying how to render the data received as input

Describe alternatives you've considered

  • Use v-ifs based on a specific type on a global component

Additional context
Currently these are the renderers of the repo:
image

@AndrewBastin
Copy link
Member

@AndrewBastin AndrewBastin commented Oct 25, 2021

Interesting, we were thinking of abstracting text based renderers actually to a more generalized system but never got around to it.

This is a low priority issue, but PRs are welcome!

@RishabhAgarwal-2001
Copy link

@RishabhAgarwal-2001 RishabhAgarwal-2001 commented Nov 25, 2021 •

Hello!
I was looking to take up the task of refactoring lenses. I am initially planning to create an abstract text-based renderer as per the previous comment.
Can I get this issue assigned to me? @AndrewBastin

@AndrewBastin
Copy link
Member

@AndrewBastin AndrewBastin commented Nov 25, 2021

@RishabhAgarwal-2001 sure!

But just to make sure you get what I have in mind:

Generally our code is moving to take advantage of Vue 3 Composables and Composition API more along with TypeScript. So abstracting out the lens renderers to a composable we can apply easily.
Second of all, lenses should work for non-text content, for example we have the ImageLensRenderer and maybe in the future we might add other binary formats as well. So, we need to keep support for them.

Anyways, feel free to ping me on Discord or Telegram if you want any help!

Assigning!

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

Successfully merging a pull request may close this issue.

None yet
4 participants