-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
code improvement/refactoring!! svelte's "bind" updates parent variabl…
…e multiple times when variable data is an array (and objects too according to sveltejs/svelte#4265 (comment)) 😲😲😲😭😭😭😭 the issue seems to be an issue with svelte for all svelte devs (not just me 😇). Here is the issue page: sveltejs/svelte#4265 And here is a REPL for an idea of the issue: https://svelte.dev/repl/316c01d1b3b34a259b8fdba66f6ee14e?version=4.0.1 *The alternative* 😉🙌😄 replacing with update functions the update variable in parent component (similar to component binding) and event handlers (similar to element/input binding) *other bits & bobs*😁😁 type safety to KeyRepArea.svelte component
- Loading branch information
Showing
11 changed files
with
105 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,27 @@ | ||
<script lang="ts"> | ||
import { updateExercise } from "$lib/exercises/CRUD/crudDB"; | ||
import { updateExercise as updateExerciseOnDb } from "$lib/exercises/CRUD/crudDB"; | ||
import type Exercise from "$lib/exercises"; | ||
import FocusLimbsList from "./FocusLimbsList.svelte"; | ||
export let exercise: Exercise; | ||
export let exerciseId: string; | ||
export let updateExercise: (updatedExercise: Exercise) => void; | ||
</script> | ||
|
||
<div | ||
style="width: 100%; height: 100%; display:flex; flex-direction:column; align-items:flex-start;" | ||
> | ||
<button type="button" on:click={() => updateExercise(exerciseId, exercise)}> | ||
<button | ||
type="button" | ||
on:click={() => updateExerciseOnDb(exerciseId, exercise)} | ||
> | ||
Update Database | ||
</button> | ||
|
||
<FocusLimbsList bind:focusLimbs={exercise.focusLimbs} /> | ||
<FocusLimbsList | ||
focusLimbs={exercise.focusLimbs} | ||
updateFocusLimbs={(updated) => | ||
updateExercise({ ...exercise, focusLimbs: updated })} | ||
/> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters