Skip to content

Commit

Permalink
merge: #3680
Browse files Browse the repository at this point in the history
3680: fix(web, sdf): Ensure that we reload the newly created schema variant r=stack72 a=stack72



Co-authored-by: stack72 <[email protected]>
  • Loading branch information
si-bors-ng[bot] and stack72 authored May 2, 2024
2 parents 2fef441 + f5ba903 commit dc9743b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions app/web/src/components/AssetListPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
/>
<VButton
label="New Asset"
:requestStatus="createAssetReqStatus"
successText="Successful"
tone="action"
icon="plus"
size="sm"
Expand Down Expand Up @@ -99,6 +101,7 @@ import ModuleExportModal from "./modules/ModuleExportModal.vue";
const assetStore = useAssetStore();
const { assetList } = storeToRefs(assetStore);
const loadAssetsReqStatus = assetStore.getRequestStatus("LOAD_ASSET_LIST");
const createAssetReqStatus = assetStore.getRequestStatus("CREATE_ASSET");
const contributeAssetModalRef = ref<InstanceType<typeof ModuleExportModal>>();
const exportSuccessModalRef = ref<InstanceType<typeof Modal>>();
Expand Down
2 changes: 1 addition & 1 deletion app/web/src/store/realtime/realtime_events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export type WsEventPayloadMap = {
changeSetId: ChangeSetId;
};
SchemaVariantCreated: {
schemaVariantId: string;
schemaId: string;
changeSetId: ChangeSetId;
};
SchemaVariantCloned: {
Expand Down
8 changes: 5 additions & 3 deletions lib/sdf-server/src/server/service/variant/create_variant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use axum::{response::IntoResponse, Json};
use serde::{Deserialize, Serialize};

use dal::schema::variant::authoring::VariantAuthoringClient;
use dal::{ChangeSet, SchemaVariantId, Visibility, WsEvent};
use dal::{ChangeSet, SchemaId, Visibility, WsEvent};

use crate::server::extract::{AccessBuilder, HandlerContext, PosthogClient};
use crate::server::tracking::track;
Expand All @@ -25,7 +25,7 @@ pub struct CreateVariantRequest {
#[derive(Deserialize, Serialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct CreateVariantResponse {
pub id: SchemaVariantId,
pub id: SchemaId,
pub success: bool,
}

Expand Down Expand Up @@ -64,6 +64,8 @@ pub async fn create_variant(
}),
);

let schema = created_schema_variant.schema(&ctx).await?;

WsEvent::schema_variant_created(&ctx, created_schema_variant.id())
.await?
.publish_on_commit(&ctx)
Expand All @@ -77,7 +79,7 @@ pub async fn create_variant(
response = response.header("force_change_set_id", force_change_set_id.to_string());
}
Ok(response.body(serde_json::to_string(&CreateVariantResponse {
id: created_schema_variant.id(),
id: schema.id(),
success: true,
})?)?)
}

0 comments on commit dc9743b

Please sign in to comment.