mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-03-20 23:13:07 +00:00
fix: Strip runtime and state fields when duplicating features
This commit is contained in:
@@ -1092,8 +1092,20 @@ export function useBoardActions({
|
|||||||
|
|
||||||
const handleDuplicateFeature = useCallback(
|
const handleDuplicateFeature = useCallback(
|
||||||
async (feature: Feature, asChild: boolean = false) => {
|
async (feature: Feature, asChild: boolean = false) => {
|
||||||
// Copy all feature data, only override id/status (handled by create) and dependencies if as child
|
// Copy all feature data, stripping id, status (handled by create), and runtime/state fields
|
||||||
const { id: _id, status: _status, ...featureData } = feature;
|
const {
|
||||||
|
id: _id,
|
||||||
|
status: _status,
|
||||||
|
startedAt: _startedAt,
|
||||||
|
error: _error,
|
||||||
|
summary: _summary,
|
||||||
|
spec: _spec,
|
||||||
|
passes: _passes,
|
||||||
|
planSpec: _planSpec,
|
||||||
|
descriptionHistory: _descriptionHistory,
|
||||||
|
titleGenerating: _titleGenerating,
|
||||||
|
...featureData
|
||||||
|
} = feature;
|
||||||
const duplicatedFeatureData = {
|
const duplicatedFeatureData = {
|
||||||
...featureData,
|
...featureData,
|
||||||
// If duplicating as child, set source as dependency; otherwise keep existing
|
// If duplicating as child, set source as dependency; otherwise keep existing
|
||||||
|
|||||||
@@ -132,6 +132,13 @@ export function useBoardPersistence({ currentProject }: UseBoardPersistenceProps
|
|||||||
const api = getElectronAPI();
|
const api = getElectronAPI();
|
||||||
if (!api.features) {
|
if (!api.features) {
|
||||||
logger.error('Features API not available');
|
logger.error('Features API not available');
|
||||||
|
// Rollback optimistic deletion since we can't persist
|
||||||
|
if (previousFeatures) {
|
||||||
|
queryClient.setQueryData(queryKeys.features.all(currentProject.path), previousFeatures);
|
||||||
|
}
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: queryKeys.features.all(currentProject.path),
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user