solidusjs/devtools-solidus

Consistent inspector state between page loads

Closed this issue · 3 comments

Certain stages of development involve a lot of navigation between pages, i.e. when setting up routes and navigation links. Currently state is preserved on a per-page basis, which generally is a good idea I think, considering working with different sites, etc.

We may want to consider trying to normalize state between pages when working within a single site (and window session) however, such that when navigating between pages expanded/collapsed sections of the context are consistent. Currently there's some extra time required here when building out pages to expand certain sections I'm working with across pages.

Obviously any variations in the context between pages would cause some issues here, but generally the objects are pretty consistent at least with stock root sections and certain resources, etc.

Right now, the plugin stores the collapsed states in LocalStorage based on the value of context.url.path. We could change it to store the collapse state based on context.url.hostname instead. I actually don't think variations would cause too many problems. If an expanded part of the tree doesn't exist in a new context, it will just be skipped over. If a part of the tree exists that didn't exist in the old context, it will be collapsed.

@pushred Are you thinking we should definitely store the state by hostname? Either way, now that I think about it, storing it just by path could cause other unexpected behavior if two different sites have the same path. So, if we don't store it just by hostname, I should probably update it to store by hostname + path.

Hmm you know what it seems to behave as I was thinking right now, maybe a side effect of d7e5476?

Hostname + path is definitely the way to go regardless. There'll definitely be overlap in common paths like /blog, /events, etc.