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

Push state support #13

Open
PauloPhagula opened this issue Apr 20, 2016 · 7 comments
Open

Push state support #13

PauloPhagula opened this issue Apr 20, 2016 · 7 comments

Comments

@PauloPhagula
Copy link

Hi @mmikowski

I'd like to know what'd be the timeline for push state support for urianchor library or if there's any plan to add it in the future at all?

Thanks

@mmikowski
Copy link
Owner

Hi @dareenzo,

I hadn't planned on adding push state support as my original review was that it wasn't well supported (it's not supported until IE10). However I am open to new adventures. Why do you think it's a good idea? What benefit do you think it will provide?

Cheers, Mike

@PauloPhagula
Copy link
Author

Hi @mmikowski

I think I'd use the following arguments

  • separating state data and the URL, would provide for shorter and more beautiful urls which in a per case basis might end-up improving SEO
  • although some old browsers like IE10 don't yet support push state, supporting it looks like the future. So, maybe depending on the features available on the browser, the library could switch between using the hash fragment or push-state.

But I do foresee that there might be a challenge perhaps with bookmark-ability and URL sharing. As if for instance I were to send you a beautiful URL, when you load the URL the app might not have enough data to process the request properly

@mmikowski
Copy link
Owner

Hi @dareenzo

Well, let me give it some thought. Don't expect a new feature tomorrow, but let me keep this open while I ponder it. You are right about beautiful URL's not containing enough information to maintain state, and also concerns with bookmarks and history controls. If you can solve those problems, please fork and issue a pull request :)

There may be some middle ground where all those objectives can be met. However, I wonder if it still would use push-state. Just because it's new doesn't mean it's a good idea.

In any event, I'm about due to give this library a update similar to powercss, so thank you for your interest and recommendations.

Cheers, Mike

@TaylerTao
Copy link

Hi @mmikowski

I think your uriAnchor plugin is good for state management, and i recommend you Backbone.History module, may be it's more powerful?

@stupidanimal
Copy link

Hi @mmikowski

I think there is a bug in 'makeAnchorString' function , that judgement

      if ( schema_map  ) {
        schema_map_val = schema_map[key_name];
        if ( getVarType( schema_map_val ) === 'Object'
          && ! schema_map_val[String( key_value )]
        ) {
          throw getErrorReject(
            'Independent key-value pair |'
            + key_name + '|' + String( key_value )
            + '| not authorized by anchor schema'
          );
        }
      }

If schema_map_val[String(key_value)] is bool val and the value is false, it will throw exception.
but I have name that val in the anchor schema.

@mmikowski
Copy link
Owner

@TaylerTao I've used backbone, and then removed it from all my projects. It's awful in just about every dimension imaginable. Code style? Router? Assumptions about data syncing? Workarounds? Templating? Yeah, all mediocre to pathetic.

Backbone is good if you've never written a SPA before. It will show you all the important functions and provide excellent examples on how not to implement them. IMO, you're better off reading a good book like "Single Page Web Applications" and then picking better tools.

@mmikowski
Copy link
Owner

@stupidanimal Thank you for a excellent feedback. I need to give the code a good review and adjustment. I will include this in my review.

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

No branches or pull requests

4 participants