-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add data-sg-replace functionality #80
Conversation
df72d02
to
3a5ab37
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another nice PR! Thank you. I'd like to add some additional context to this functionality. The API that I'm leaning towards for this story look like this:
<a href="/posts" data-sg-visit data-sg-replace>
data-sg-replace
sets an extra parameter to the visit function only. Its in the same vein as the existing data-sg-placeholder
functionality that look like this:
<a href="/posts" data-sg-visit data-sg-placeholder="/somekey">
My comments below will revolve around that leaning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great! Just a few more comments from me.
Great work! I'll give this a test during the weekend, and merge. |
This looks great! I'm marking this for a 1.0 release. I don't want to merge this in quite yet as I want to focus on the typescript conversion, but def on my radar! |
1f571a5
to
1fd0762
Compare
@kholdrex I'm so sorry, V1.0 is release and I ended up preferring a different way of handling this. I'm closing this, but thank you so much for this contribution. |
#62
This PR adds a new data attribute,
data-sg-replace
. This attribute allows for replacing the browser's history state instead of pushing a new state when navigating.Changes
visit
function to accept asuggestedAction
parameter.data-sg-replace
attribute in theHandlerBuilder
class.data-sg-replace
and pass the appropriate action.data-sg-replace
functionality.Tests
visit
is called with thereplace
action when thedata-sg-replace
attribute is present.suggestedAction
parameter.