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

chore: next release #1563

Merged
merged 2 commits into from
Jul 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 8 additions & 0 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @vue-flow/core

## 1.39.1

### Patch Changes

- [#1562](https://github.com/bcakmakoglu/vue-flow/pull/1562) [`e83b1ef`](https://github.com/bcakmakoglu/vue-flow/commit/e83b1ef9be83df10be9d4c8a35d6d0caff26e6b9) Thanks [@bcakmakoglu](https://github.com/bcakmakoglu)! - Check if injected vue flow state matches options id, otherwise create new state

- [#1562](https://github.com/bcakmakoglu/vue-flow/pull/1562) [`e83b1ef`](https://github.com/bcakmakoglu/vue-flow/commit/e83b1ef9be83df10be9d4c8a35d6d0caff26e6b9) Thanks [@bcakmakoglu](https://github.com/bcakmakoglu)! - Prefer options id over scope id when finding vue flow internal state by id

## 1.39.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue-flow/core",
"version": "1.39.0",
"version": "1.39.1",
"private": false,
"license": "MIT",
"author": "Burak Cakmakoglu<[email protected]>",
Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/composables/useVueFlow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
* @public
* @returns a vue flow store instance
* @param idOrOpts - id of the store instance or options to create a new store instance

Check warning on line 22 in packages/core/src/composables/useVueFlow.ts

View workflow job for this annotation

GitHub Actions / build-and-test (ubuntu-latest, 20)

Expected @param names to be "id". Got "idOrOpts"
*/
export function useVueFlow(id?: string): VueFlowStore
export function useVueFlow(options?: FlowOptions): VueFlowStore
Expand All @@ -33,7 +33,7 @@
const options = isOptsObj ? idOrOpts : { id: idOrOpts }

const id = options.id
const vueFlowId = scope?.vueFlowId || id
const vueFlowId = id ?? scope?.vueFlowId

let vueFlow: Injection

Expand All @@ -42,9 +42,9 @@
* this should be the regular way after initialization
*/
if (scope) {
const injection = inject(VueFlow, null)
if (typeof injection !== 'undefined' && injection !== null) {
vueFlow = injection
const injectedState = inject(VueFlow, null)
if (typeof injectedState !== 'undefined' && injectedState !== null && (!vueFlowId || injectedState.id === vueFlowId)) {
vueFlow = injectedState
}
}

Expand All @@ -63,7 +63,7 @@
* _or_ if the store instance we found does not match up with provided ids
* create a new store instance and register it in storage
*/
if (!vueFlow || (vueFlow && id && id !== vueFlow.id)) {
if (!vueFlow || (vueFlowId && vueFlow.id !== vueFlowId)) {
const name = id ?? storage.getId()

const state = storage.create(name, options)
Expand Down
Loading