Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: load all components at the right time #5165

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions app/web/src/store/components.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1427,29 +1427,11 @@ export const useComponentsStore = (forceChangeSetId?: ChangeSetId) => {
],
);

realtimeStore.subscribe(
`${this.$id}-workspace`,
`workspace/${workspaceId}`,
[
{
eventType: "ChangeSetApplied",
callback: (data) => {
// If the applied change set has rebased into this change set,
// then refetch (i.e. there might be updates!)
if (data.toRebaseChangeSetId === changeSetId) {
this.FETCH_ALL_COMPONENTS();
}
},
},
],
);

const actionUnsub = this.$onAction(handleStoreError);

return () => {
actionUnsub();
realtimeStore.unsubscribe(`${this.$id}-changeset`);
realtimeStore.unsubscribe(`${this.$id}-workspace`);
};
},
},
Expand Down
5 changes: 2 additions & 3 deletions app/web/src/store/views.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -650,14 +650,13 @@ export const useViewsStore = (forceChangeSetId?: ChangeSetId) => {
this.recentViews.push(id);
},
async LIST_VIEWS(all = false) {
await componentsStore.FETCH_ALL_COMPONENTS();

return new ApiRequest<ViewDescription[]>({
method: "get",
url: API_PREFIX,
onSuccess: async (views) => {
this.viewList = views;
this.SORT_LIST_VIEWS();
await componentsStore.FETCH_ALL_COMPONENTS();
for (const { id } of views) {
// assuming we're coming from "on load", we have the FETCH that gets the selectedViewId
if (all || id !== this.selectedViewId)
Expand All @@ -674,6 +673,7 @@ export const useViewsStore = (forceChangeSetId?: ChangeSetId) => {
});
},
async FETCH_VIEW_GEOMETRY(viewId: ViewId) {
// requires all components to be in place!
return new ApiRequest<{
viewId: ViewId;
name: string;
Expand Down Expand Up @@ -709,7 +709,6 @@ export const useViewsStore = (forceChangeSetId?: ChangeSetId) => {
([componentId, geo]) => {
const node = componentsStore.allComponentsById[componentId];
if (!node) return;
if (!view) return; // no idea why linting is complaining that i need this
let geometry: IRect;
if ("width" in node) {
geo.width = node.width;
Expand Down
Loading