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

Reset the farm name value in the create farm dialog #3503

Merged
merged 4 commits into from
Oct 20, 2024
Merged
Changes from 1 commit
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
12 changes: 10 additions & 2 deletions packages/playground/src/dashboard/components/create_farm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@
</form-validator>
</v-card-text>
<v-card-actions class="justify-end my-1 mr-2">
<v-btn color="anchor" @click="showDialogue = false">Close</v-btn>
<v-btn
color="anchor"
@click="
showDialogue = false;
$emit('update:name', '');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we pass the name to the parent it is not used as i see, i think this behavior need some refactor, no need to bind the farm name here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's just a reset for farm name on close

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can just remove the name prop, it will reset the farm name.
we are not using the name on the parent component

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I did it disappeared on blur before submit / close.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not related to props, this related to the dialog component, u can try to add persistent to the dialog component

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

"
>Close</v-btn
>
<v-btn @click="createFarm" :loading="isCreating" :disabled="!valid || isCreating">Create</v-btn>
</v-card-actions>
</v-card>
Expand All @@ -71,7 +78,7 @@ export default {
required: true,
},
},
setup(props) {
setup(props, { emit }) {
const showDialogue = ref(false);
const isCreating = ref(false);
const gridStore = useGrid();
Expand All @@ -83,6 +90,7 @@ export default {
createCustomToast("Farm created successfully.", ToastType.success);
notifyDelaying();
showDialogue.value = false;
emit("update:name", "");
} catch (error) {
console.log(error);
createCustomToast("Failed to create farm.", ToastType.danger);
Expand Down
Loading