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

feat: ✨ added includeQueryParams flag #260

Merged
merged 2 commits into from
Aug 10, 2022

Conversation

dragos199993
Copy link
Contributor

@dragos199993 dragos199993 commented Mar 14, 2022

Description

Motivation and Context

Gives the option to use the entire URL in order to have a cache key that includes query parameters.
Fixes: #259

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Enhancement (changes that improvement of current feature or performance)
  • Refactoring (changes that neither fixes a bug nor adds a feature)
  • Test Case (changes that add missing tests or correct existing tests)
  • Code style optimization (changes that do not affect the meaning of the code)
  • Docs (changes that only update documentation)
  • Chore (changes that don't modify src or test files)

Self Check before Merge

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@biiibooo
Copy link
Contributor

biiibooo bot commented Mar 14, 2022

👋 @dragos199993

💖 Thanks for opening this pull request! 💖

Please follow the contributing guidelines. And we use semantic commit messages to streamline the release process.

Examples of commit messages with semantic prefixes:

  • fix: don't overwrite prevent_default if default wasn't prevented
  • feat: add graph.scale() method
  • docs: graph.getShortestPath is now available

Things that will help get your PR across the finish line:

  • Follow the TypeScript coding style.
  • Run npm run lint locally to catch formatting errors earlier.
  • Document any user-facing changes you've made.
  • Include tests when adding/changing behavior.
  • Include screenshots and animated GIFs whenever possible.

We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

: sheet.hasOwnProperty('cssRules').length,
: // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
sheet.hasOwnProperty('cssRules').length,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there any other solution to this? hasOwnProperty returns boolean so .length is not a valid method

Copy link

@ryan3sg ryan3sg Mar 14, 2022

Choose a reason for hiding this comment

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

can we use ('cssRules' in sheet) for this?

@biiibooo
Copy link
Contributor

biiibooo bot commented Apr 4, 2022

Hiya!
This PR has gone quiet. Spooky quiet. 👻
We get a lot of PRs, so we currently close PRs after 60 days of inactivity. It’s been at least 20 days since the last update here. If we missed this PR or if you want to keep it open, please reply here. You can also add the label "not-stale" to keep this PR open!
Thanks for being a part of the Antv community! 💪💯

@biiibooo biiibooo bot added the stale label Apr 4, 2022
@dragos199993
Copy link
Contributor Author

This PR is still valid

@biiibooo biiibooo bot removed the stale label Apr 5, 2022
@MatanYemini
Copy link

Any reason why not move this forward?

@osplm
Copy link

osplm commented Apr 21, 2022

Was about to open a PR exactly for this problem. Would be nice to merge this 👍

@@ -10,10 +10,14 @@ const cache: {
[url: string]: Promise<Metadata>
} = {}

function getCacheKey(url: string) {
function getCacheKey(url: string, includeQueryParams: boolean | undefined) {
let key = url.replace(/\?.*/, '')
Copy link

Choose a reason for hiding this comment

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

Nitpick: No need to replace if we will reassign the full url after so we should replace only if it's not to includeQueyParams right?

@ortonomy
Copy link

ortonomy commented May 5, 2022

Really need this. This lib is incompatible with libraries like next.js which caches images and retrieves them like /next/_image?url=..... -- which appear to html-to-image as the same URL currently

@RodrigoTomeES
Copy link

Hi, any update about this?

@biiibooo
Copy link
Contributor

biiibooo bot commented Jun 7, 2022

Hiya!
This PR has gone quiet. Spooky quiet. 👻
We get a lot of PRs, so we currently close PRs after 60 days of inactivity. It’s been at least 20 days since the last update here. If we missed this PR or if you want to keep it open, please reply here. You can also add the label "not-stale" to keep this PR open!
Thanks for being a part of the Antv community! 💪💯

@biiibooo biiibooo bot added the stale label Jun 7, 2022
@ortonomy
Copy link

For anyone else looking for a solution to this, at least with next.js, I found out that next.js has a built in proxy that they call 'redirects' -- I was able to make it look like the image was coming from local, and with a different URL each time by not using next.js's built in image lib and proxying requests so they were 'secure' via the server: https://nextjs.org/docs/api-reference/next.config.js/redirects

@biiibooo biiibooo bot removed the stale label Jun 14, 2022
@biiibooo
Copy link
Contributor

biiibooo bot commented Jul 4, 2022

Hiya!
This PR has gone quiet. Spooky quiet. 👻
We get a lot of PRs, so we currently close PRs after 60 days of inactivity. It’s been at least 20 days since the last update here. If we missed this PR or if you want to keep it open, please reply here. You can also add the label "not-stale" to keep this PR open!
Thanks for being a part of the Antv community! 💪💯

@biiibooo biiibooo bot added the stale label Jul 4, 2022
@RodrigoTomeES
Copy link

There is any plan to merge this PR?

@biiibooo biiibooo bot removed the stale label Jul 5, 2022
@biiibooo
Copy link
Contributor

biiibooo bot commented Jul 25, 2022

Hiya!
This PR has gone quiet. Spooky quiet. 👻
We get a lot of PRs, so we currently close PRs after 60 days of inactivity. It’s been at least 20 days since the last update here. If we missed this PR or if you want to keep it open, please reply here. You can also add the label "not-stale" to keep this PR open!
Thanks for being a part of the Antv community! 💪💯

@biiibooo biiibooo bot added the stale label Jul 25, 2022
@bubkoo bubkoo merged commit 259d71e into bubkoo:master Aug 10, 2022
@biiibooo
Copy link
Contributor

biiibooo bot commented Aug 10, 2022

👋 @dragos199993 Congrats on merging your first pull request! 🎉🎉🎉

@biiibooo biiibooo bot removed the PR: unreviewed label Aug 10, 2022
@biiibooo biiibooo bot added the PR: merged label Aug 10, 2022
github-actions bot pushed a commit that referenced this pull request Aug 11, 2022
# [1.10.0](v1.9.0...v1.10.0) (2022-08-11)

### Bug Fixes

* 🐛 cloneCSSStyle: copy transformOriginProp ([#297](#297)) ([76b978a](76b978a))
* 🐛 font format could be without qoutation ([#217](#217)) ([2a96149](2a96149))
* 🐛 set selected attribute on option to draw it ([#280](#280)) ([caf97c8](caf97c8))
* 🐛 text breaks on the last word ([#270](#270)) ([062c98a](062c98a))
* test specs ([c7a664e](c7a664e))

### Features

* ✨ add 'fetchRequestInit' option ([#210](#210)) ([c51da3a](c51da3a))
* ✨ added includeQueryParams flag ([#260](#260)) ([259d71e](259d71e))
@biiibooo
Copy link
Contributor

biiibooo bot commented Aug 11, 2022

🎉 This PR is included in version 1.10.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@biiibooo biiibooo bot added the released label Aug 11, 2022
istaiti pushed a commit to inscreen/html-to-image that referenced this pull request Feb 7, 2023
* feat: ✨ added includeQueryParams flag

* chore: 🔧 updated readme file

Co-authored-by: dragos.nedelcu <dragos.nedelcu@pitechplus.com>
istaiti pushed a commit to inscreen/html-to-image that referenced this pull request Feb 7, 2023
* 🐛 cloneCSSStyle: copy transformOriginProp ([bubkoo#297](bubkoo#297)) ([76b978a](bubkoo@76b978a))
* 🐛 font format could be without qoutation ([bubkoo#217](bubkoo#217)) ([2a96149](bubkoo@2a96149))
* 🐛 set selected attribute on option to draw it ([bubkoo#280](bubkoo#280)) ([caf97c8](bubkoo@caf97c8))
* 🐛 text breaks on the last word ([bubkoo#270](bubkoo#270)) ([062c98a](bubkoo@062c98a))
* test specs ([c7a664e](bubkoo@c7a664e))

* ✨ add 'fetchRequestInit' option ([bubkoo#210](bubkoo#210)) ([c51da3a](bubkoo@c51da3a))
* ✨ added includeQueryParams flag ([bubkoo#260](bubkoo#260)) ([259d71e](bubkoo@259d71e))
istaiti pushed a commit to inscreen/html-to-image that referenced this pull request Feb 7, 2023
* feat: ✨ added includeQueryParams flag

* chore: 🔧 updated readme file

Co-authored-by: dragos.nedelcu <dragos.nedelcu@pitechplus.com>
istaiti pushed a commit to inscreen/html-to-image that referenced this pull request Feb 7, 2023
* 🐛 cloneCSSStyle: copy transformOriginProp ([bubkoo#297](bubkoo#297)) ([76b978a](bubkoo@76b978a))
* 🐛 font format could be without qoutation ([bubkoo#217](bubkoo#217)) ([2a96149](bubkoo@2a96149))
* 🐛 set selected attribute on option to draw it ([bubkoo#280](bubkoo#280)) ([caf97c8](bubkoo@caf97c8))
* 🐛 text breaks on the last word ([bubkoo#270](bubkoo#270)) ([062c98a](bubkoo@062c98a))
* test specs ([c7a664e](bubkoo@c7a664e))

* ✨ add 'fetchRequestInit' option ([bubkoo#210](bubkoo#210)) ([c51da3a](bubkoo@c51da3a))
* ✨ added includeQueryParams flag ([bubkoo#260](bubkoo#260)) ([259d71e](bubkoo@259d71e))
istaiti pushed a commit to inscreen/html-to-image that referenced this pull request Feb 7, 2023
* feat: ✨ added includeQueryParams flag

* chore: 🔧 updated readme file

Co-authored-by: dragos.nedelcu <dragos.nedelcu@pitechplus.com>
istaiti pushed a commit to inscreen/html-to-image that referenced this pull request Feb 7, 2023
* 🐛 cloneCSSStyle: copy transformOriginProp ([bubkoo#297](bubkoo#297)) ([76b978a](bubkoo@76b978a))
* 🐛 font format could be without qoutation ([bubkoo#217](bubkoo#217)) ([2a96149](bubkoo@2a96149))
* 🐛 set selected attribute on option to draw it ([bubkoo#280](bubkoo#280)) ([caf97c8](bubkoo@caf97c8))
* 🐛 text breaks on the last word ([bubkoo#270](bubkoo#270)) ([062c98a](bubkoo@062c98a))
* test specs ([c7a664e](bubkoo@c7a664e))

* ✨ add 'fetchRequestInit' option ([bubkoo#210](bubkoo#210)) ([c51da3a](bubkoo@c51da3a))
* ✨ added includeQueryParams flag ([bubkoo#260](bubkoo#260)) ([259d71e](bubkoo@259d71e))
istaiti pushed a commit to inscreen/html-to-image that referenced this pull request Feb 7, 2023
* feat: ✨ added includeQueryParams flag

* chore: 🔧 updated readme file

Co-authored-by: dragos.nedelcu <dragos.nedelcu@pitechplus.com>
istaiti pushed a commit to inscreen/html-to-image that referenced this pull request Feb 7, 2023
* 🐛 cloneCSSStyle: copy transformOriginProp ([bubkoo#297](bubkoo#297)) ([76b978a](bubkoo@76b978a))
* 🐛 font format could be without qoutation ([bubkoo#217](bubkoo#217)) ([2a96149](bubkoo@2a96149))
* 🐛 set selected attribute on option to draw it ([bubkoo#280](bubkoo#280)) ([caf97c8](bubkoo@caf97c8))
* 🐛 text breaks on the last word ([bubkoo#270](bubkoo#270)) ([062c98a](bubkoo@062c98a))
* test specs ([c7a664e](bubkoo@c7a664e))

* ✨ add 'fetchRequestInit' option ([bubkoo#210](bubkoo#210)) ([c51da3a](bubkoo@c51da3a))
* ✨ added includeQueryParams flag ([bubkoo#260](bubkoo#260)) ([259d71e](bubkoo@259d71e))
istaiti pushed a commit to inscreen/html-to-image that referenced this pull request Feb 7, 2023
* feat: ✨ added includeQueryParams flag

* chore: 🔧 updated readme file

Co-authored-by: dragos.nedelcu <dragos.nedelcu@pitechplus.com>
istaiti pushed a commit to inscreen/html-to-image that referenced this pull request Feb 7, 2023
* 🐛 cloneCSSStyle: copy transformOriginProp ([bubkoo#297](bubkoo#297)) ([76b978a](bubkoo@76b978a))
* 🐛 font format could be without qoutation ([bubkoo#217](bubkoo#217)) ([2a96149](bubkoo@2a96149))
* 🐛 set selected attribute on option to draw it ([bubkoo#280](bubkoo#280)) ([caf97c8](bubkoo@caf97c8))
* 🐛 text breaks on the last word ([bubkoo#270](bubkoo#270)) ([062c98a](bubkoo@062c98a))
* test specs ([c7a664e](bubkoo@c7a664e))

* ✨ add 'fetchRequestInit' option ([bubkoo#210](bubkoo#210)) ([c51da3a](bubkoo@c51da3a))
* ✨ added includeQueryParams flag ([bubkoo#260](bubkoo#260)) ([259d71e](bubkoo@259d71e))
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.

Cache not working as expected
9 participants