error since update to Meteor Version 0.4 - meteor

i have a template with list of input-elements. their value is the title-element of an document. The input-elemnts have an keyup-event, so that when i wrote in the input-element, the title will updated. when i focus the input-elemnt, the Session-variable selectedDoc is set with the id of the document. until then it works. In another template i have a following function:
Template.content.isSelected = function () {
return !Session.equals("selectedDoc",null) ? 'small' : '';
}
When i used the function above in my code, the following error occurs.
when i focus an input-element and write something, after the first letter the the focus disappeared. the error occurs only by the first time, i focus an input-element.
what am I doing wrong? with Version 0.3.9 everything worked well.
thanks

What am I doing wrong?
You're not following Meteor or reading the changelog, so you haven't noticed the API changes.
If you read them, especially Spark, and adapt your code accordingly; your code will work on 0.4.

Related

Console Error for woocommerce_shared_settings deprecation

I am working with WooCommerce for the first time and I am currently implementing WC filters on the shop page. The filters show up but are not functional, and the console is throwing the following errors:
ERROR 1: woocommerce_shared_settings filter in Blocks is deprecated. See https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/trunk/docs/contributors/block-assets.md
ERROR 2: deprecated.min.js?ver=932d8bb37da8bbb396a7a3f754345e08:2 select control in #wordpress/data-controls is deprecated since version 5.7. Please use built-in resolveSelect control in #wordpress/data instead.
The errors disappear when I remove the filters.
I have located the file where the deprecated code exists. I also read the WC docs about how to fix the issue and it presented this code:
use Automattic\WooCommerce\Blocks\Package;
use Automattic\WooCommerce\Blocks\Assets\AssetDataRegistry;
Package::container()->get( AssetDataRegistry::class )->add( $key, $value )
It doesn't say where to put this code, though. Where should I put it to solve this issue?
I have the same problem.
Which is the file you located?
Here also says you have to add, on the "client side", this code:
wc.wcSettings.getSetting( 'key' );

Is it possible to show all options in Tokenize2?

Tokenize2 is a javacsript lib to select multiple options.
It provides a very neat UI to start writing and then get a list of options to select from. Selected options will show up as "tags" that can be removed with "x" link.
So far all is fine. But Right now you need to know what your looking for and start write at least one character to see matching alternatives.
In my scenario there are very few alternatives and they are not known to the user. I would like to show ALL options when the user clicks the input box. There is a configuration option named searchMinLength but it is already set to 0.
Is there a workaround that can be used? Maybe like triggering load and dropdown manually?
I know there are a lot of similar alternatives but I picked Tokenize2 because:
It looks clean and nice
It works in mobile browsers
I don't know if there is an "official" approach, but after some investigation I have found an acceptable workaround.
After downloading the Tokenizer2 sourceode I found the following line that triggered my attention:
if(this.input.val().length > 0){
this.trigger('tokenize:search', [this.input.val()]);
}
My interpretation is that the internal search command is not triggered unless the user input has at least one character. This line in sourcecode could easily be modified. I have filed a suggestion for this here: https://github.com/zellerda/Tokenize2/issues/26
My current workaround is to add an event listener for the select event and there trigger the internal search command. That works fine for my scenario and does not force a source code rewrite.
$("#my-dropdown").on("tokenize:select", function (e: Event, routedEvent: boolean) {
$("#my-dropdown").trigger('tokenize:search', "");
});
Tokenize2
This link worked for me GitHub
$('.tokenize-sample-demo1').on('tokenize:select', function(container){
$(this).tokenize2().trigger('tokenize:search', [$(this).tokenize2().input.val()]);
});

Ruby/Selenium/Watir-Webdriver: "path is not absolute" error for absolute path

document_name ='TestDoc'
document_path = ("/Users/Me/QA/Project/Documents/#{document_name}")
File.new ("/Users/Me/QA/Project/Documents/#{document_name}") # => File is created
filename_field.send_keys("#{document_path}")
filename_field.send_keys :tab # => To Trigger event but where error occurs
filename_field = browser.file_field(:name, 'file') declared in a module elsewhere.
As far as I can tell, I have provided an absolute path for the filename to upload the file but when the tab key is sent, an error occurs of:
Selenium::WebDriver::Error::UnknownError: unknown error: path is not absolute:
With an odd squiggly symbol in RubyMine that I've never seen before. Any ideas?
Update:
I added
puts filename_field.value
# => C:\fakepath\TestDoc
Spoke to one of the developers and she said "Browser does it to fake things out, so the filesystem isn't exposed". Not sure if that helps solve my issue or I'm SOL?
That error comes from Chromedriver, and comes from sending an incorrect path string to a file element. Since :tab is not a path, it is correctly raising an error.
You shouldn't need to send a tab; just sending the path of the file should accomplish what you need.
I see many small strange things in your code.
Why
document_path = ("/Users/Me/QA/Project/Documents/#{document_name}")
Not
document_path = "/Users/Me/QA/Project/Documents/#{document_name}"
Why
filename_field.send_keys("#{document_path}")
Not
filename_field.send_keys(document_path)
But the main question is why you are using send_keys instead of set?
I failed to reproduce your problem. Maybe it will be possible if you will provide your html. But i suggest you to try:
filename_field.set(document_path)
Because you can easily check it even with irb send_keys is acting differently in firefox and in chrome for example. So maybe problem with it.
Another suggestion
That is a much more weak idea. But...
Try to clear value before changing it. You can do it with javascript:
b.execute_script("arguments[0].value=''", field)
I had the same issue with Chromedriver 2.26.436421 and it was solved when I removed the code which was sending the tab key.
With previous Chromedriver sending tab key was required to trigger the change event on the file input but with latest one it seems like it is only causing issues and the change event gets triggered without it.

middleware_stack.js:31 Uncaught Error: Handler with name 'route' already exists. Iron router Meteor

My code was working fine until last night and suddenly I am getting this error and routes are not working at all.
middleware_stack.js:31Uncaught Error: Handler with name 'route' already exists.
for simple routes like this:
Router.route('/admin/dashboard', {
template:"adminDashboard"
});
Router.route('/admin/create/table', {
template:"create_table"
});
I cannot figure out the error, I have checked all the routes. Have anyone else faced this error?
This is a known issue. The problem occurs with recent versions of Google Chrome and Microsoft Edge (edit: also Firefox now).
It has been fixed by a recent iron router update, it should be fixed by meteor update iron:middleware-stack.
Edit: If the middleware-stack package rolls back when you restart the server, check #bigsan's comment
Edit: this issue was fixed in iron:middleware-stack 1.1.0 .
I have the same problem. Weirdly, I have this problem on Chrome 51 but not on Chrome 46. I guess this has to do with updates in the javascript engine, and I'll post here if I figure out what exactly.
In the meantime, the workaround I used was to explicitly add names to the routes. It doesn't matter what they are, they just have to be declared, otherwise iron-router think the name of the route is "route." So your code would become:
Router.route('/admin/dashboard', {
name: "Boaty_McBoatface",
template:"adminDashboard"
});
Router.route('/admin/create/table', {
name: "Guacamole",
template:"create_table"
});
First, have a look here and see when this error is thrown. So, actually I have not faced that error but I've read about it. Further have a look at the official guide and post. I see that you are trying to create a subdirectory to your route /admin. Usually, I do this by using this.render() function. Concerning the layout I use this.layout() so I think that if you use these functions and remove template:"adminDashboard". It will work.

browseForOpenMultiple - crashing

I am trying to work with browseForOpenMultiple function inside Flex, sdk 3.5, I am trying to figure out a bug. The browseForOpenMultiple does not crash everytime, but it seems as though I can upload a file once, but when I go to upload a second file, it crashes when the browseForOpenMultiple function is called. Anyone have any ideas about possible causes?
Update:
private function browseForFiles():void
{
fileBrowser = new File();
fileBrowser.addEventListener(FileListEvent.SELECT_MULTIPLE, filesSelected);
fileBrowser.addEventListener(Event.CANCEL, fileSelectionCancelled);
fileBrowser.browseForOpenMultiple("Select Desired Media File(s)", [(mode == "Media")? MediaTypes.getFileFilter() : MediaTypes.getVideoFilter()]);
}
So the code in our array of file extensions was crashing when there were over 60 items listed in an array that gets converted into a string for the FileFilter. This may not be an Adobe limit, but I wanted to make mention that the crash is fixed, so that others who may be encountering issues with browseForOpenMultiple will know what the issue was for this problem. This is not code that I originally wrote, so I will check into it for more clues, but for the time being, too many array items being joined together into a string for FileFilter object caused the crash.
It could be how it's construct the File, without a real file reference.
Try something like this :
var fileBrowser = File.desktopDirectory

Resources