Skip to content

Using Include in live list breaks #347

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

Closed
srkraut opened this issue Apr 1, 2020 · 8 comments
Closed

Using Include in live list breaks #347

srkraut opened this issue Apr 1, 2020 · 8 comments

Comments

@srkraut
Copy link

srkraut commented Apr 1, 2020

Hello i am using query builder and live list to show data

_queryBuilder = QueryBuilder<ParseObject>(ParseObject('post')) ..includeObject(["poster"]) ..orderByDescending('createdAt');

it woks fine at start but when new data is added and the data used from 'poster' pointer can't be shown and throws null exception . i am trying to show user name .

snapshot.loadedData .get('poster') .get('full_name')

@fischerscode
Copy link
Contributor

I think this problem occurs as LiveList is build on top of LiveQuery and LiveQuery does not
handle included objects (as far as I know).

As a quick work around you could re-fetch the included object manually.

I agree that such a workaround is not ideal and as this feature would come handy in more complex apps, I will have a lock, if implementing an automated process is possible.

@srkraut
Copy link
Author

srkraut commented Apr 1, 2020

Can you pass me an example . How can i refetch the included object inside livelist ?

Or refresh the livelist manually running full query again

Currently i am refreshing whole page , disable the live query and using livelist just for showing list .

Any optimization and code suggestions are welcome.

@fischerscode
Copy link
Contributor

You could wrap the widget, that uses the poster object inside a FutureBuilder using this future:
snapshot.loadedData .get<ParseObject>('poster') .update()

@srkraut
Copy link
Author

srkraut commented Apr 1, 2020

Using update doesn't work

this works

FutureBuilder( future:snapshot.loadedData.get<ParseObject>('poster').getAll() , builder: (BuildContext context, AsyncSnapshot<ParseResponse> shot) { return shot.hasData ? Text( shot.data.result[0]['full_name'], style: TextStyle( fontSize: 18.0, fontWeight: FontWeight.bold), ) : Text('-'); }, ),

@srkraut srkraut closed this as completed Apr 1, 2020
@srkraut
Copy link
Author

srkraut commented Apr 1, 2020

but its kind of slow and when scrolling values goes and comes .

@fischerscode
Copy link
Contributor

fischerscode commented Apr 2, 2020

@srkraut
I've implemented a possible solution in dd837d1 and 8d4a4af.

More improvements can be made, but this should fix your including problem.
For further information have a lock at #348.

phillwiggins pushed a commit that referenced this issue Apr 4, 2020
* LiveList: reload included objects

First implementation

* Key was wrong on order change

* include sub-includes

* reuse loaded pointers

* Deleted stuff
@srkraut
Copy link
Author

srkraut commented Apr 6, 2020

great it works

@srkraut srkraut closed this as completed Apr 6, 2020
@MungaraJay
Copy link

Hello @srkraut @maaeps @phillwiggins

I am facing similar kind of error for livequeries with includeObject not working.

So can you check the following issue and let me know how can i use livequeries with includeobject.
#424

phillwiggins added a commit that referenced this issue Aug 28, 2020
* Release 1.0.27 - Create base branch

* Fix for #347 (include in LiveList) (#348)

* LiveList: reload included objects

First implementation

* Key was wrong on order change

* include sub-includes

* reuse loaded pointers

* Deleted stuff

* LiveList autoupdate included sub-objects (#349)

* LiveList: reload included objects

First implementation

* Key was wrong on order change

* include sub-includes

* reuse loaded pointers

* Deleted stuff

* Adding listening on included objects to LiveList

* Updated readme for ParseLiveList

* Update parse_live_list.dart

* LiveList: sync subObjects after reconnect (#352)

* Sync subObjects after reconnect

* Update README.md

* Update README.md (#353)

* ISSUE-351: Replaced isTypeOfException with Exception (#355)

Great work! Thank you

* RegisterSubClass and smaler changes (#368)

* added subclass handler

* integraded subclass handler

* added constructor for QueryBuilder using registered SubClasses

* subclass handler optimizations

* Convenience changes

* Convenience change

* sembast CoreStore on macos

* Fix: ParseUser updated on server but not locally

This should be a fix for:
#364
and
#256

* Update README.md

* Update README.md

* Update README.md (#367)

* Save installationId when new installation created. Send installationId when User login (#375)

* ParseLiveElement (#376)

* First implementation for ParseLiveElement

* ParseLiveElement further implementation

* Update parse_live_list.dart

* ParseLiveElement working

* News methods for ParseQuery -  whereMatchesKeyInQuery and whereDoesNotMatchKeyInQuery (#379)

* Add method whereMatchesKeyInQuery

Add method whereMatchesKeyInQuery

* Update parse_query.dart

* Fix whereMatchesKeyInQuery / whereDoesNotMatchKeyInQuery

* Update README.md

* Update README.md

* Update README.md

* Add google login helper (#387)

- Update README to show how to get google login attributes for parse

* Update parse_response_builder.dart (#390)

* [web] Check web before Platform.isX (#392)

Platform.isX is unsupported in web

* Make web compatible calls for locale and skip PackageInfo (#395)

* Make web compatible calls for locale and skip PackageInfo

* Also get country code for web locale

* Add description of early web support

* Added ParseFile check to _canBeSerialized() (#396)

* Update README.md (#397)

Fix Parse Server parameter name

* ParseLiveList: first implementation of lazyLoading (#407)

Setting lazyLoading=false should disable lazyLoading.

* Update parse_live_list.dart (#406)

In theory this should not make any difference. In practise sometimes an error gets thrown:
The following NoSuchMethodError was thrown while finalizing the widget tree:
The method 'dispose' was called on null.
Receiver: null
Tried calling: dispose()

* File Support for web (#409)

* created files and started implementation

* add different filetypes to sdk

* Update README.md

* add an other file example to README (#410)

* added file example to README

* Update README.md

* Web file upload: set content type to "text/plain" incase neighter name nor url is set (#411)

This breaks the extension at the uploaded file, but otherwise the upload would fail with a server error.

* LiveQuery reconnecting intervals (#414)

* parseFileConstructor was missing at Parse.initialize

* add liveListRetryIntervals to Parse.initialize

* replace kIsWeb with its definition (#415)

Using less libaries is always good.

* release/1.0.27 update dependencies

* Release/1.0.27 (#427)

* forgetLocalSession before login / signUP / loginAnonymous #426

* forgetLocalSession before login / signUP / loginAnonymous #426

* Release 1.0.27 - Pre-release process
- Update dependencies

* Release 1.0.27 - Pre-release process
- Static analysis fixes

Co-authored-by: Maximilian Fischer <[email protected]>
Co-authored-by: Michal Baran <[email protected]>
Co-authored-by: Maximilian Fischer <[email protected]>
Co-authored-by: Phani Rithvij <[email protected]>
Co-authored-by: Danaru <[email protected]>
Co-authored-by: Rodrigo de Souza Marques <[email protected]>
Co-authored-by: vreamer <[email protected]>
Co-authored-by: Dmytro Karpovych <[email protected]>
Co-authored-by: Nils Strelow <[email protected]>
Co-authored-by: hyperrecursive <[email protected]>
fischerscode added a commit to fischerscode/Parse-SDK-Flutter that referenced this issue Sep 5, 2020
* LiveList: reload included objects

First implementation

* Key was wrong on order change

* include sub-includes

* reuse loaded pointers

* Deleted stuff
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

3 participants