Refactor event history routing#984
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
| $: compactPage = $page.url.pathname.endsWith('compact'); | ||
| $: jsonPage = $page.url.pathname.endsWith('json'); |
There was a problem hiding this comment.
Do you think we even need routes for these views? Maybe could just make the last selected view a sticky preference.
There was a problem hiding this comment.
We don't, I was being overly cautious about removing them since there will be old links with /feed or /compact. What I did in the latest commit is remove them from any internal routes, but if a user does go to .../history/feed or .../history/compact or .../history/json, i redirect them to /history
There was a problem hiding this comment.
So I'm using the existing sticky view preference (eventViewType) to render the right view.
const views = {
feed: WorkflowHistoryFeed,
compact: WorkflowHistoryCompact,
json: WorkflowHistoryJson,
};
$: view = views[$eventViewType] ?? WorkflowHistoryFeed;
<svelte:component this={view} />
| <!-- <svelte:fragment slot="timeline"> | ||
| <EventHistoryTimelineContainer /> | ||
| </svelte:fragment> --> |
There was a problem hiding this comment.
Is this supposed to be commented out?
There was a problem hiding this comment.
yeah for the time being. I leave it commented out so we know where it goes once it's ready to flip on.
|
|
||
| const workflow = $page.params.workflow; | ||
|
|
||
| const views = { |
What was changed
Remove slots for event history pages to prevent n + 1 growth of rerendering event history after navigating.
Essentially all this does is move everything into the [run]/__layout@root.svelte and I use $page.url.pathname.endsWith to determine whether to show feed/compact/json.
It does feel strange to need to keep empty feed/index.svelte / compact.svelte / json.svelte files just to let svelte know the route exists. But this way we don't need to change any url patterns.
Why?
Prevents grow of rerenderings