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

SoftDelete2 Skip Symbol mismatch in browser #522

Closed
FossPrime opened this issue Jul 25, 2019 · 2 comments
Closed

SoftDelete2 Skip Symbol mismatch in browser #522

FossPrime opened this issue Jul 25, 2019 · 2 comments

Comments

@FossPrime
Copy link
Contributor

FossPrime commented Jul 25, 2019

Steps to reproduce

  1. Use SoftDelete2 remove hooks on the client or a server.

Like so:

import feathers from "@feathersjs/feathers";
import memory from "feathers-memory";
import * as commonHooks from "feathers-hooks-common"; 
const { softDelete2 } = commonHooks.default

const app = feathers();
app.use("todos", memory());
const todos = app.service("todos");

todos.hooks({
  before: {
    all: [softDelete2()]
  },
  after: {
    all: [softDelete2()]
  }
})
  
; ( async () => {
  await todos.create({id: 0, todo: 'you should no see this.'});
  await todos.remove(0)
})()

Actual behavior

hooks.js?470c:123 
Uncaught (in promise) Error: before hook for 'get' method returned invalid hook object
    at updateCurrentHook (hooks.js?470c:123)

System configuration

Module versions: 4.20.7

NodeJS version: 10 and 12, does not matter.

Operating System: Linux

Browser Version: Chrome 75 Stable

Module Loader: Webpack

Vue Project with above code: npm start to run app.zip

Live Sandbox: https://glitch.com/edit/#!/join/d7683fdb-b81c-4541-9566-e15144f60223

Theories:

  • @feathersjs/common is packaged several times with different versions. Each produces it's own SKIP symbol. This means that in an environment that supports Symbols, none of the versions will pass an equality conditional. I replaced the feathers-hooks-common's SKIP with 'FAILWHALE', that did not affect the SKIP passed to hooks.js that the feathers instance is using.
@FossPrime FossPrime changed the title SoftDelete2 Broken SoftDelete2 Symbol mismatch in browser Jul 25, 2019
@FossPrime FossPrime changed the title SoftDelete2 Symbol mismatch in browser SoftDelete2 Skip Symbol mismatch in browser Jul 25, 2019
@FossPrime
Copy link
Contributor Author

Screenshot from 2019-07-25 17-48-49

import feathers from "@feathersjs/feathers";
import memory from "feathers-memory";
import * as commonHooks from "feathers-hooks-common";
const { softDelete2 } = commonHooks.default

const app = feathers();
app.use("todos", memory());
const todos = app.service("todos");

todos.hooks({
  before: {
    all: [softDelete2()]
  },
  after: {
    all: [softDelete2()]
  }
})

console.log('about to do async')

; ( async () => {
  let msg
  await todos.create({id: 0, todo: 'you should not see this.'})
  console.log('running post create find', await todos.find())
  await todos.remove(0)
  console.log('running vanilla find', await todos.find())
  console.log('running ignoreDeletedAt get', await todos.get(0, { $ignoreDeteledAt: true}))
  console.log('running ignoreDeletedAt find', await todos.find({ $ignoreDeteledAt: true}))
})()

https://isomorph.glitch.me/

https://glitch.com/edit/#!/isomorph

@FossPrime
Copy link
Contributor Author

Mrrrph.... looks like a bug in the behavior of vue-cli's implementation of bable/webpack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant