Meteor-files: Meteor@React: TypeError: this._debug is not a function

Created on 4 Aug 2017  路  6Comments  路  Source: veliovgroup/Meteor-Files

Hi!
after refactoring Blaze app to react I'm having an issue:

Exception from Tracker recompute function:
meteor.js?hash=6d285d84547b3dad9717a7c89c664b61b45ea3d8:942 TypeError: this._debug is not a function
    at module.runModuleSetters.FilesCollectionCore.link (ostrio_files.js?hash=3a35370b63efe4dbb13a6152206c2a5383101832:1358)
    at FilesCollection.Images.link (collections.js:44)
    at FileCursor.module.runModuleSetters.FileCursor.link (ostrio_files.js?hash=3a35370b63efe4dbb13a6152206c2a5383101832:1445)
    at Product.imageFile (product.jsx:29)
    at Product.render (product.jsx:45)
    at modules.js?hash=38670f4eb4440e3943dd829ee8146bc073e26707:60106
    at measureLifeCyclePerf (modules.js?hash=38670f4eb4440e3943dd829ee8146bc073e26707:59386)
    at ReactCompositeComponentWrapper._renderValidatedComponentWithoutOwnerOrContext (modules.js?hash=38670f4eb4440e3943dd829ee8146bc073e26707:60105)
    at ReactCompositeComponentWrapper._renderValidatedComponent (modules.js?hash=38670f4eb4440e3943dd829ee8146bc073e26707:60132)
    at ReactCompositeComponentWrapper.performInitialMount (modules.js?hash=38670f4eb4440e3943dd829ee8146bc073e26707:59672)
npm remove/install --save file-type fs-extra
meteor remove/add ostrio:files



md5-49d130074417dbaf0c8dcee8a2a8e7e2



rm -Rf ./node_modules
meteor reset # <- ! Caution: will drop local mongo db
meteor npm install --save
meteor update



md5-3110516bcbf2838ba2eeceda18d4251c



Images = new FilesCollection({
  collectionName: 'Images',
  allowClientCode: false // Disallow remove files from Client
});
const _origLink = Images.link;
Images.link = (v)=> {
  return _origLink(v).replace(__meteor_runtime_config__.ROOT_URL, 'xxxxxxxxx/');
};

like Images.link don't works

.link() question

Most helpful comment

@dr-dimitru
yes. issue solved!
above i wrote it immediately after your hint,
big thank for your excellent support and quality package!

All 6 comments

Yes!
changing part of code to:
const _origLink = Images.link;
Images.link = function (v) {
return _origLink.call(Images, v).replace(__meteor_runtime_config__.ROOT_URL, 'xxxxxxxxx/');
};
issue solved!
magnificently!
Strange that it worked before this moment :)

You've lost the method context, use bind or call to fix:

const _origLink = Images.link;
Images.link = function (v) {
  return _origLink.call(Images, v).replace(__meteor_runtime_config__.ROOT_URL, 'xxxxxxxxx/');
};

OR:

const _origLink = Images.link.bind(Images);
Images.link = (v)=> {
  return _origLink(v).replace(__meteor_runtime_config__.ROOT_URL, 'xxxxxxxxx/');
};

@dr-dimitru
please, explain this point:
_origLink.call(
how it's works?
_origLink is link to Images method?
How does call work here?

When you assign new function to Images.link

Images.link = function (v) {/* .. */};

Its context is redefined.

_origLink.call( how it's works?

.call(context, [arg1, arg2, arg3...]) Will assign context (first argument) before calling the function

Hello @valorloff ,

Is this fixed?

@dr-dimitru
yes. issue solved!
above i wrote it immediately after your hint,
big thank for your excellent support and quality package!

Was this page helpful?
0 / 5 - 0 ratings