Skip to content
This repository has been archived by the owner on Dec 6, 2022. It is now read-only.

Manually trigger script for non-hover use cases #29

Merged
merged 2 commits into from
Nov 29, 2020

Conversation

robinske
Copy link
Contributor

@robinske robinske commented Nov 24, 2020

What:
Fixes #28

Manually triggers PinUtils.build() for non-hover use cases (hover use case works with existing plugin code).

Why:
Without this, the script only works on page refresh due to the way Gatsby loads 3rd party scripts. There is a similar workaround in the Twitter plugin and a delay in the Google Analytics plugin

Checklist:

  • Documentation
  • Tests
  • Ready to be merged

This feels like a hack since the PinUtils.build() function isn't explicitly documented, but I've tried a lot of different things to make this work and this is the best option I've found. At the very least it's consistent with the Twitter plugin which is blessed by Gatsby.

@codecov-io
Copy link

codecov-io commented Nov 24, 2020

Codecov Report

Merging #29 (4248543) into master (f914483) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #29   +/-   ##
=======================================
  Coverage   60.00%   60.00%           
=======================================
  Files           1        1           
  Lines          10       10           
  Branches        3        3           
=======================================
  Hits            6        6           
  Misses          2        2           
  Partials        2        2           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f914483...4248543. Read the comment docs.

@robinmetral
Copy link
Contributor

Looks good @robinske! I think we can just go for this, since as you mentioned, this is what the Twitter plugin does.

One question: could you add a bit about this on the README under "Usage"? I'm thinking we could have a small section explaining how to configure the plugin and use it when we want to only add the pin button to individual images. Happy to do it as well if you'd like me to.

@robinske
Copy link
Contributor Author

Happy to - I think this ties into my comment on #1 about the attributes so some clarification will be useful. I'll get to that sometime this week probably. Thanks for your snappy responses @robinmetral !

@robinske
Copy link
Contributor Author

Updated the docs!

Comment on lines +59 to +60
Note: not all attributes are supported in the plugin yet.
[See issues for more details](https://github.com/robinmetral/gatsby-plugin-pinterest/issues).
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for adding this 🙏 We can also revisit this README once all options are supported. If it gets too long we could also extract docs to another page, or even deploy a small example site to Netlify 🙂

@robinmetral
Copy link
Contributor

This looks great, thank you @robinske!

@all-contributors please add @robinske for code and doc

@allcontributors
Copy link
Contributor

@robinmetral

I've put up a pull request to add @robinske! 🎉

@robinmetral robinmetral merged commit 163beee into gatsby-uc:master Nov 29, 2020
@github-actions
Copy link

🎉 This PR is included in version 3.2.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

Save Button only loads on page refresh for manually set data-pin-do tags
3 participants