Code Monkey home page Code Monkey logo

Comments (6)

khatruong2009 avatar khatruong2009 commented on July 26, 2024 1

Hi @naedx, thank you for submitting this issue. We'll take a look at it and get back to you when there is an update.

from amplify-flutter.

naedx avatar naedx commented on July 26, 2024

I suspect the issue comes from this line:

 
if (modelType is PaginatedModelType) {
      final filter = request.variables['filter'] as Map<String, dynamic>?;
      final limit = request.variables['limit'] as int?;

      final resultNextToken = dataJson![_nextToken] as String?;
      dynamic requestForNextResult;
      // If result has nextToken property, prepare a request for the next page of results.
      if (resultNextToken != null) {
        final variablesWithNextToken = <String, dynamic>{
          ...request.variables,
          _nextToken: resultNextToken,
        };
        requestForNextResult = GraphQLRequest<T>(                          // <<=================== here (line 97)
          document: request.document,
          decodePath: request.decodePath,
          variables: variablesWithNextToken,
          modelType: request.modelType,
        );
      }
      decodedData = modelType.fromJson(
        dataJson!,
        limit: limit,
        filter: filter,
        requestForNextResult:
            requestForNextResult as GraphQLRequest<PaginatedResult<Model>>?,
      ) as T;
    } else {
      decodedData = modelType.fromJson(dataJson!) as T;
    }
    return GraphQLResponse<T>(data: decodedData, errors: errors);

It omits copying over the authorizationMode from the previous request.

from amplify-flutter.

naedx avatar naedx commented on July 26, 2024

A workaround to the problem is to copy the requestForNextResultwhile adding in the value for the authorizationMode:

    final nextRequest = result.data?.requestForNextResult?.copyWith(
        authorizationMode: APIAuthorizationType.oidc,
    );

Sidenote:

Currently, ModelQueries.list<T>() accepts several parameters but not the nextToken which forces us to try to use the requestForNextResult value just to perform a paginated request.

from amplify-flutter.

Jordan-Nelson avatar Jordan-Nelson commented on July 26, 2024

A fix for this was merged an should be included in the next release

from amplify-flutter.

naedx avatar naedx commented on July 26, 2024

Awesome, thank you! Looking forward to it.

from amplify-flutter.

NikaHsn avatar NikaHsn commented on July 26, 2024

Thank you for your patience. The issue has been fixed in version 1.8.0. and I'm closing it. However, if you encounter any issues after updating to version 1.8.0, please don't hesitate to reopen it.

from amplify-flutter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.