Bug with stateSave?

Bug with stateSave?

sveatlosveatlo Posts: 9Questions: 3Answers: 0

Hi!
Currently I'm experiencing some problems with the stateSave feature. The problem is, it save two different versions for the same page into the localStorage, eg. "www.example.com/foo" but also for "www.example.com/foo/". The problem is, I cannot control which page the user will be redirected, therefore he might get a different saved data each time.
Is this a bug? How can I fix this?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin

    Is it a bug? Good question - I'm not actually sure! DataTables uses the path name for the state saving which is why they are different. You can use stateSaveCallback and stateLoadCallback to provide your own state saving methods if you want to work around this issue just now.

    Mean while I'll have a bit of a think about this and what I want the correct behaviour to be!

    Allan

  • sveatlosveatlo Posts: 9Questions: 3Answers: 0

    Thank you very much for your answer.
    My personal look at this problem is, that both these URLs are pointing to the very same pages, so their content should be same as well.
    Either way you decide, please let me know.

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin

    They are in this case, but it is also possible (depending on the server-side and routing etc) that they point to different pages (although I think generally that would be unusual).

    Allan

  • sveatlosveatlo Posts: 9Questions: 3Answers: 0

    Hi!
    I need to tell my boss about our future steps. Could you please tell me, how have you decided?

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin
    Answer ✓

    To be honest I haven't had time to think about it much, but I'm inclined to remove trailing /s from the path. So yes, this is a bug that needs to be fixed.

    Allan

This discussion has been closed.