Skip to content

Commit

Permalink
Merge pull request #5217 from systeminit/jkeiser/view-geometry-id
Browse files Browse the repository at this point in the history
Don't send geometry Ids to the frontend
  • Loading branch information
vbustamante authored Jan 7, 2025
2 parents 7c9abb5 + ad16d1f commit 7a35fa2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 3 additions & 1 deletion app/web/src/store/views.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -708,9 +708,11 @@ export const useViewsStore = (forceChangeSetId?: ChangeSetId) => {
if (!v) return;

view.viewNodes[v.id] = new DiagramViewData({
...v,
...VIEW_DEFAULTS,
...geo,
// if geo has properties like "id" we don't want them to overwrite view props
// so we spread v last
...v,
componentType: ComponentType.View,
});
});
Expand Down
9 changes: 5 additions & 4 deletions lib/sdf-server/src/service/v2/view/get_diagram.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ use dal::diagram::view::{View, ViewId, ViewView};
use dal::diagram::{Diagram, DiagramError};
use dal::{slow_rt, ChangeSetId, ComponentId, DalContext, WorkspacePk};
use serde::{Deserialize, Serialize};
use si_frontend_types::RawGeometry;
use telemetry::prelude::debug;

#[derive(Deserialize, Serialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct GeometryResponse {
view_id: ViewId,
name: String,
components: HashMap<ComponentId, Geometry>,
views: HashMap<ViewId, Geometry>,
components: HashMap<ComponentId, RawGeometry>,
views: HashMap<ViewId, RawGeometry>,
}

pub async fn get_geometry(
Expand Down Expand Up @@ -55,10 +56,10 @@ pub async fn get_geometry(

match geo_represents {
GeometryRepresents::Component(component_id) => {
components.insert(component_id, geometry);
components.insert(component_id, geometry.into_raw());
}
GeometryRepresents::View(view_id) => {
views.insert(view_id, geometry);
views.insert(view_id, geometry.into_raw());
}
}
}
Expand Down

0 comments on commit 7a35fa2

Please sign in to comment.