Skip to content

Plugin system might not working #1942

@rustem-nasyrov

Description

@rustem-nasyrov

Environment

No response

Reproduction

  1. Create a new project
  2. Install vue, pinia, pinia-orm.
  3. Follow the guide.
  4. Nothing happens, repository didn't modified.
example.js
import { createPinia, setActivePinia } from "pinia"
import { createORM, Model, useRepo, definePiniaOrmPlugin } from "pinia-orm"
import { createApp } from "vue"

const customPlugin = () => definePiniaOrmPlugin((...args) => {
  console.log(args)

  return args[0]
})

const app = createApp({})
const pinia = createPinia()
  .use(
    createORM({
      plugins: [
        customPlugin(),
      ]
    })
  )

app.use(pinia)
setActivePinia(pinia)

class Test extends Model {
  static entity = 'test'

  static fields() {
    return {
      id: this.uid(),
      firstName: this.string(),
      lastName: this.string(),
      email: this.string(),
    }
  }
}

console.log(useRepo(Test))
node example.js
Output
Repository {
  database: Database { models: { test: [Test] } },
  model: Test { pivot: undefined },
  pinia: undefined,
  queryCache: WeakCache { [Symbol(Symbol.toStringTag)]: undefined },
  hydratedDataCache: Map(0) {},
  use: undefined,
  config: {
    model: {
      namespace: '',
      withMeta: false,
      hidden: [Array],
      visible: [Array]
    },
    cache: { shared: true, provider: [class WeakCache] }
  }
}

Describe the bug

Plugin system might not working.

Additional context

No response

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions