Page MenuHomePhabricator

Tokenizers lose state changes after navigation actions
Open, LowPublic

Description

This is a weird bug that I have only just noticed. If I start creating a new Maniphest task on mobile (Chrome on a Nexus 5) and then change tabs (change to another tab and then back again), the Projects field is not longer filled.

Interestingly, the page seems to semi-refresh when changing tabs.

Event Timeline

joshuaspence raised the priority of this task from to Needs Triage.
joshuaspence updated the task description. (Show Details)
joshuaspence added projects: Maniphest, Mobile.
joshuaspence added a subscriber: joshuaspence.

Do you feel this is fixable by Phabricator?

Seeing as the other fields persist, I suspect that it should be fixable.

You can reproduce this in a normal web browser (at least, in Safari):

  • Click "Edit Task" on any task.
  • Add a project to the "Projects" field.
  • Type some text in the "Description" field.
  • Click a link on the page, like the Phabricator logo.
  • Press the browser back button.

The description change persists, but the field change does not.

This is probably fixable, but also probably involves some stupid garbage nonsense where we serialize tokens into a hidden field value.

Actually, it seems that the subscribers field doesn't persist either (I originally thought that it did, but it seems that only the default subscriber of myself persists). So yeah, this may not be fixable.

You can reproduce this in a normal web browser (at least, in Safari):

  • Click "Edit Task" on any task.
  • Add a project to the "Projects" field.
  • Type some text in the "Description" field.
  • Click a link on the page, like the Phabricator logo.
  • Press the browser back button.

The description change persists, but the field change does not.

This is probably fixable, but also probably involves some stupid garbage nonsense where we serialize tokens into a hidden field value.

Oh interesting. Usually, in a desktop environment, I'd just have different windows open... So I haven't seen that issue there.

Native fields (text, textarea) work fine; tokenizers exhibit this behavior because (some hand-waving here) we aren't writing their values to a real input, sort of, probably. Blah blah bfcache browsers etc etc.

I think the fix is to serialize the tokenizer state into a hidden input as the user adds tokens, then check for it and restore the state after the navigation/reload/back button.

But we might also have some kind of init/startup behavior that's getting run again when it shoudn't be, or when it should do something different/smarter, or be breaking the bfcache incorrectly, or who knows what.

Serializing into a hidden field sounds like the correct approach to me.

I do think there's some truth in your theory about running init behavior when we shouldn't, as I'm still seeing occasional weirdness when changing tabs:

Mobile_weirdness (1×1 px, 108 KB)

Hah, well at least Chrome on iOS doesn't seem to have this behavior. Strange that iOS is better than Android though for Chrome. Is it a current version?

epriestley renamed this task from Projects do not persist when changing tabs in "Create New Task" form to Tokenizers lose state changes after navigation actions.May 7 2015, 1:42 PM
epriestley triaged this task as Low priority.