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

Last image is not removed from initialPreviewConfig after delete #785

Closed
koxu1996 opened this issue Oct 28, 2016 · 0 comments
Closed

Last image is not removed from initialPreviewConfig after delete #785

koxu1996 opened this issue Oct 28, 2016 · 0 comments

Comments

@koxu1996
Copy link
Contributor

koxu1996 commented Oct 28, 2016

While trying to fix #779 I ran into this issue.

Reproduce:

  1. Go to: http://plugins.krajee.com/file-preview-management-demo#preview-data
  2. Delete all images
  3. See initialPreviewConfig by entering this in web console: JSON.stringify($('#input-pd').data('fileinput').initialPreviewConfig)
  4. Now you can see there is one element in initialPreviewConfig left, for example: "[null,null,{"type":"video","size":375000,"filetype":"video/mp4","caption":"KrajeeSample.mp4","url":"/file-upload-batch/2","key":3},null,null,null]", although fileinput is empty!

What cause this:
https://github.com/kartik-v/bootstrap-fileinput/blob/master/js/fileinput.js#L231-L233
Like in this question http://stackoverflow.com/questions/40317226/two-references-to-object-but-when-modify-it-by-one-second-still-show-unchanged, here we have initialPreviewConfig referenced by previewCache.data[id].config, so writing previewCache.data[id].config = [] would not change initialPreviewConfig.

kartik-v added a commit that referenced this issue Oct 31, 2016
Better image resize handling fixes #769 and fixes #785
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