Skip to content

Commit

Permalink
Merge pull request #4983 from systeminit/jkeiser/code-regen-reload
Browse files Browse the repository at this point in the history
Make code reload after AI gen
  • Loading branch information
stack72 authored Nov 18, 2024
2 parents 257e517 + 2a1ae7e commit 18267b5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/web/src/components/FuncEditor/FuncEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ watch(
);
watch(
() => selectedFuncCode.value?.funcId,
() => [selectedFuncCode.value?.funcId, selectedFuncCode.value?.code],
() => {
if (!selectedFuncCode.value) {
return;
Expand Down
5 changes: 2 additions & 3 deletions app/web/src/store/func/funcs.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -854,18 +854,17 @@ export const useFuncStore = () => {
},
{
eventType: "FuncCodeSaved",
callback: (data, metadata) => {
callback: ({ generated, funcCode: { funcId } }, metadata) => {
if (metadata.change_set_id !== selectedChangeSetId) return;

const funcId = data.funcCode.funcId;
// TODO we update every time *any* function is generated unless you are in the
// function editor. That's because we can't tell from here if the function is
// the asset function editor from here (and we can't useAssetStore() because
// that would cause a circular dependency). We should fix this, but asset
// generation doesn't happen so often it's a giant problem right now.
if (
(funcId === this.selectedFuncId || !this.selectedFuncId) &&
data.generated &&
generated &&
this.generatingFuncCode[funcId]
) {
this.FETCH_CODE(funcId);
Expand Down

0 comments on commit 18267b5

Please sign in to comment.