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

Research History manipulation influence and Form data #15

Open
rumkin opened this issue Sep 3, 2019 · 6 comments · Fixed by #18
Open

Research History manipulation influence and Form data #15

rumkin opened this issue Sep 3, 2019 · 6 comments · Fixed by #18
Labels
enhancement New feature or request

Comments

@rumkin
Copy link
Owner

rumkin commented Sep 3, 2019

Currently data input in form fields will be lost when navigating through history. It could cause to data loss. Browsers are preserving it in some cases. Pill's implementation should be as close to default browser behavior as possible.

@rumkin rumkin added the enhancement New feature or request label Sep 3, 2019
@tamb
Copy link
Contributor

tamb commented Sep 9, 2019

Maybe a series of plugins or extensions to pill. Think of it like webpack plugins except you add them into your hooks.

onMounting(){
PreserveFormPlugin()
}

???
Wondering if this is a way to add functionality without sacrificing core.
Another plugin could be added for dynamic script tags. How do you want people to enhance your library? Should chaining be added? More config options?

I'd gladly help write plugins

@rumkin
Copy link
Owner Author

rumkin commented Sep 10, 2019

Pill should emulate browsers one-to-one and support this out of the box due to standard behavior is the most expected behavior. So it couldn't be a plugin.

Wondering if this is a way to add functionality without sacrificing core.

Current hooks structure covers almost every step of Pill's work. If it's not so, then it should be fixed. And yes this is the way to enhance Pill. But as I written above it's the core feature.

How do you want people to enhance your library?

Good question. I have only general idea of how to do it. Opened #17 issue for extensibility discussion.

@rumkin
Copy link
Owner Author

rumkin commented Sep 10, 2019

I'd gladly help write plugins

It would be super!

This was linked to pull requests Jul 25, 2020
@rumkin
Copy link
Owner Author

rumkin commented Aug 28, 2020

There is an issue with the beforeunload event which wouldn't be triggered for intermediary pages. It could be solved by using hook onUnmounting or pill:unmounting event to dispatch beforeunload as a custom event. It should be specified in the docs or added as an option.

@tamb
Copy link
Contributor

tamb commented Aug 31, 2020

@rumkin My concern preserving form data is that it opens up security issues. The data is stored client-side, which really should be avoided.

Perhaps the plugin should come with that warning. Maybe before we push plugins we research security issues with browser history manipulation. I'd be interested to check out how react-router handles this scenario.

@rumkin
Copy link
Owner Author

rumkin commented Sep 1, 2020

@tamb By the default entered form field value could be restored when user navigates by history. The only field type which shouldn't be stored is the password type. So I think it's ok to store some data into history state itself, while it reproduces the default behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants