Closed Bug 735063 Opened 13 years ago Closed 13 years ago

Move place creation to drawer

Categories

(Pancake Graveyard :: Front-end, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: gbrander, Assigned: gbrander)

Details

Too much state is being kept in Top. This is supposedly the canonical state of the app, but it is totally unreliable because it can be modified by any app, and is not managed with a Finite State Machine. We don't need a State Machine for the amalgamated app -- it can be considered stateless, where individual apps (UIWebViews) maintain their own state and can be sent events (analogous to POST) or addressed via URL (analogous to GET). Currently the life-cycle for creating a new place in a stack looks like this: 1. Native: navigate event 2. Top: receive event. 3. Top: check currently active stack ID (what happens if Top does not have this information? No idea.) 4. PUT link to lattice, create place in stack, passing stack_id Top has on record. 5. Pass resulting place data to drawer 6. Drawer looks for StackModel based on ID handed from Top (what happens if Drawer has a different active stack_id then Top? What happens if ID does not exist?) 7. Gets PlaceCollection from StackModel 8. Inserts place into collection from data. Adds to collection at insertion point based on currently active place in StackModel. What should happen: 1. Native: navigate event 2. Top receive event 3. Forward event directly to drawer (Top should disappear altogether eventually) 4. Drawer creates a SiteModel from place_url and place_title passed by navigate event. 5. SiteModel is added to PlaceCollection belonging to currently active stack. SiteModel is decorated with the stack_id and session_id from the parent stack. 6. siteModel.save() issues a PUT request to lattice/:username/stack/link, creating the place. Model is given a place_id in the response. 7. SiteModel ID is made currently active place in StackModel. --- An overview: Drawer should keep track of: * Currently active stack_id * StackCollection StackModel should keep track of: * Currently active place_id * Places Collection PlaceCollection should keep track of: * Pointer to parent StackModel instance SiteModel should keep track of: * stack_id Basically, the only duplicated state information should be IDs or pointers.
Target Milestone: --- → M2
Done as of this commit: https://bitbucket.org/mozillapancake/pancake/changeset/1c1dcf0af730. After a successful merge with default, I will mark this fixed.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.